Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless docs/start #3

Merged
merged 25 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d15e6c9
Starting the headless docs: introductory background about guillotine
espen42 Sep 29, 2020
dd1b78f
Lesson overview
espen42 Sep 29, 2020
e621604
Reference to next chapter
espen42 Sep 29, 2020
b9d1516
Mention the added guillotine API in the project structure overview in…
espen42 Sep 30, 2020
59469e2
Source file structure, and general thematic layout of chapter 8.
espen42 Sep 30, 2020
e55f9cd
Groundwork part of chapter 8 is done
espen42 Sep 30, 2020
9ceb9ed
Started describing guillotineApi, and added a section at the end abou…
espen42 Sep 30, 2020
71c2a9d
Guillotine helpers described, part controller is done. Only missing t…
espen42 Sep 30, 2020
43ffa25
React components and movie-list part setup. Static list is finished, …
espen42 Sep 30, 2020
f8385f2
Details: emphasis and illustrations
espen42 Sep 30, 2020
218cf26
Exposing the guillotine API
espen42 Oct 1, 2020
7827344
Added the frontend request from MovieList.jsx, and updating the DOM w…
espen42 Oct 1, 2020
913256b
Chapter 8 first draft done.
espen42 Oct 1, 2020
c8419bf
Tweak
espen42 Oct 1, 2020
662fd6e
Tweak
espen42 Oct 1, 2020
bdfe60c
Tweak
espen42 Oct 1, 2020
299e925
Intro to the chapter 9: standalone webapp. Could use a few links, and…
espen42 Oct 7, 2020
67aabf7
Merge master into headlessDocs/webapp
espen42 Oct 8, 2020
ce89890
Started on the first variation
espen42 Oct 25, 2020
7911b60
First variation is done.
espen42 Oct 26, 2020
77d3acb
Docs: shortening and diadactifying the intro, and swapping the two ap…
espen42 Nov 2, 2020
3831e8a
First, completely headless variation is done. Rewrite and simplify th…
espen42 Nov 2, 2020
9fa18f1
Docs: second part with XP helpers, first draft. PR ready.
espen42 Nov 2, 2020
3a7635b
PR fixes and suggestions (#3 and #6)
espen42 Nov 4, 2020
d506d71
Merge pull request #6 from enonic/headlessDocs/webapp
espen42 Nov 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/entries.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ Entries are pretty much just standard JSX files, but they must follow *two requi
1. is located either in a folder either below *_/site/_* or below one of the *entryDirs* folders listed in _react4xp.properties_ (see also <<jsxpath#, jsxPath>>),
2. and *default-exports a function*: `props?=>reactComponent` - a function that _may_ take a `props` argument (serializable JS object: no functions) and _must_ return a react component.

NOTE: *Important:* if your entry uses react hooks or it's a react class component, read <<#classes-and-hooks, Classes and hooks in entries>> below.
[NOTE]
====
*Important:*

- There should be no call to `React.render` or `ReactDOM.render` in an entry (or a compiled entry or dependency bundle - keep an eye on your imports). React4xp will handle that call in the right context.
- If your entry uses react hooks or it's a react class component, read <<#classes-and-hooks, Classes and hooks in entries>> below.
====

{zwsp} +

Expand Down
1,348 changes: 1,348 additions & 0 deletions docs/guillotine.adoc

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/imports-and-dependency-chunks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export default ({colors, selectedIndex, clickFunc}) =>

In this section we'll adjust some settings to make the code above work.

TIP: Some of this is covered in more detail under <<entries#, entries>> and <<jsxpath#, jsxPaths>>.
TIP: If you need more details, some of this is covered in more depth under <<entries#, entries>> and <<jsxpath#, jsxPaths>>.

{zwsp} +

Expand Down Expand Up @@ -416,6 +416,7 @@ Adding paths like e.g. `foo/bar/baz` or `../../hey/ho/lets/go` is perfectly fine

{zwsp} +

[[webpack_rules]]
=== Adding webpack rules
Next, we'll add some *custom webpack rules to handle the style imports*. First, we need to tell react4xp to use an extra webpack config file. Return to _react4xp.properties_ to add another property:

Expand Down
Binary file added docs/media/add_movies.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/click-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/click-fill-dom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/edit_movie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/graphql-playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/guillotine.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/movie-list-part-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/webapp_applications.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/webapp_url.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
"title": "7 - Imports and chunks",
"document": "imports-and-dependency-chunks"
},
{
"title": "8 - Headless: guillotine",
"document": "guillotine"
},
{
"title": "9 - Headless: webapp",
"document": "webapp"
},
{
"title": "Entries",
"document": "entries"
Expand Down
2 changes: 1 addition & 1 deletion docs/pages-parts-and-regions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Start with a completely generic content type: _site/content-types/my-content/my-
.my-content.xml:
[source,xml,options="nowrap"]
----
<content-type xmlns="urn:enonic:xp:model:1.0">
<content-type>
<display-name>My Content</display-name>
<description>Just some content</description>
<super-type>base:structured</super-type>
Expand Down
21 changes: 12 additions & 9 deletions docs/setup.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,35 @@ Remember to create a *new XP sandbox* when completing the project wizard.
== Project structure

If you're used to working with a typical XP project using https://developer.enonic.com/templates/webpack[webpack], the structure in your project root folder will now look familiar -
the biggest news is `react4xp.properties` and the folder `resources/react4xp/`.
the biggest news are _react4xp.properties_ and the folders _src/main/resources/react4xp/_ and _src/main/resources/headless_.

TIP: This is just an overview, no need to know it by heart to get started - we'll get back to all of these in more detail. For the most impatient, the takeaway is: *put your JSX source files somewhere below `react4xp/entries/` or `site/`*.
TIP: This is just an overview, no need to know it by heart to get started - we'll get back to all of these in more detail. For the most impatient, the takeaway is: *put your JSX source files somewhere below _react4xp/entries/_ or _site/_*.

[source,files]
----
build.gradle <!--1-->
build.gradle <!--1-->
gradle.properties
settings.gradle
package.json

react4xp.properties <!--2-->
react4xp.properties <!--2-->

src/
main/
resources/
react4xp/ <!--3-->
react4xp/ <!--3-->
entries/
shared/
headless/
guillotineApi.es6 <!--4-->
guillotineRequest.es6

----

<1> A set of gradle config files and `package.json`. These define the build process and project structure, and in particular, make sure that the *lib-react4xp library* and *react4xp npm package* are installed right.
<2> `react4xp.properties`: tune the most common properties of the react4xp project.
<3> The `react4xp/` folder is opt-in: can be ignored for now, and doesn't need to contain anything. But when fine-tuning the build later in the tutorial, we'll get back to why you might find it handy to have a separate place for some of your react components (in ultra-short: the `entries\` folder is for react components that can be used directly by react4xp, the `shared\` folder is for common components imported by, and shared between, the entries).

<1> A set of gradle config files and _package.json_. These define the build process and project structure, and in particular, make sure that the *lib-react4xp library* and *react4xp npm package* are installed right.
<2> _react4xp.properties_: tune the most common properties of the react4xp project.
<3> The _react4xp/_ folder is opt-in: can be ignored for now, and doesn't need to contain anything. But when fine-tuning the build later in the tutorial, we'll get back to why you might find it handy to have a separate place for some of your react components (in ultra-short: the _entries/_ folder is for react components that can be used directly by react4xp, the _shared\_ folder is for common components imported by, and shared between, the entries).
<4> Under _headless/_, the starter includes two wrappers that make it easier to use the optional guillotine api for using react4xp in a <<guillotine#, headless context>>.

{zwsp} +

Expand Down
Loading