-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from bensmithett/un-snakecase
snake_case ➡️ camelCase/TitleCase
- Loading branch information
Showing
20 changed files
with
103 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
12.16.0 | ||
14.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"printWidth": 120, | ||
"quoteProps": "as-needed", | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Tropical's 4 core files | ||
|
||
## `build.js` | ||
|
||
A script run in Node.js that: | ||
|
||
- Uses Webpack to compile `prerender.js` and `client.js` so they can run, respectively, in Node.js and the browser. | ||
- Calls the default export of `prerender.js` to (you guessed it!) prerender your static site. | ||
|
||
## `client.js` | ||
|
||
The JS file loaded by all pages in a `<script>` tag in the browser. | ||
|
||
If using Tropical's `asIsland` helper to enable component hydration, import those components into this file and pass them to `hydrateIslands`. | ||
|
||
## `hydrationHelpers.js` | ||
|
||
Optional helpers for enabling targeted component [hydration](https://reactjs.org/docs/react-dom.html#hydrate) (see below). | ||
|
||
## `prerender.js` | ||
|
||
Prerenders your static site: | ||
|
||
- Builds a HTML file from every `.js` or `.mdx` page in `pages` | ||
- Builds a [JSON Feed](https://www.jsonfeed.org/) containing every page with `collection: 'posts'` in its metadata | ||
|
||
## Hydration helpers | ||
|
||
### `asIsland(componentName, Component, options)` | ||
|
||
A [higher order component](https://reactjs.org/docs/higher-order-components.html) that annotates your prerendered components for hydration by `hydrateIslands`. | ||
|
||
#### Props | ||
|
||
- `componentName`: the name of the component, as configured in `hydrateIslands` *(string, required)* | ||
- `Component`: any React component whose props can be serialised with `JSON.stringify` *(React component, required)* | ||
- `options`: *(object)* | ||
- `islandTag`: the HTML element to wrap the component with *(string, default: 'div')* | ||
- `islandProps`: any props to be passed to the island element *(object, default: {})* | ||
|
||
### `hydrateIslands(components)` | ||
|
||
Hydrates any components in the browser that were prerendered using `asIsland`. | ||
|
||
#### Props | ||
|
||
- `components`: an object containing the components to be hydrated *(object, required)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react' | ||
import ExampleComponent from './ExampleComponent' | ||
|
||
export default { title: 'ExampleComponent' } | ||
|
||
export const basic = () => <ExampleComponent alertMessage={'Hello!'} /> |
File renamed without changes
2 changes: 1 addition & 1 deletion
2
app/components/post_list/post_list.js → ...onents/ExamplePostList/ExamplePostList.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...components/post_list/post_list.stories.js → ...xamplePostList/ExamplePostList.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters