Skip to content

Commit bc32a25

Browse files
redallendgutride
authored andcommitted
feat(gatsby): Refactor Gatsby (#1656)
* minimum working docs * add nav * prettier props and token rendering * refactor * live editing * sloppy dynamic imports * Convert react-core docs to markdown * react-core layouts and demos * #### to ## * navbar * titles * pretty css variables * chart docs * table docs * icon docs * remember to super * add static assets * add prop description * change build target * clean * make static copy (cleaner) * order is very important * pretty fullscreen links that will never conflict * fix bundle size * axe * add docs for new components * fix lerna run build * fix nav * add styled system * more styling * versions on index page * add handlebars * clean + favicon * yarn.lock * add docs * fix build * doc updates * pretty table * style * remove console.log * fix active link * style index, fix nav flash? * real nice index * remove console.log
1 parent 4f8b740 commit bc32a25

410 files changed

Lines changed: 9529 additions & 12042 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jobs:
3939
command: |
4040
yarn build:docs &&
4141
cp -r packages/patternfly-4/react-docs/public .public/patternfly-4 &&
42-
cp -r packages/patternfly-4/react-docs/public/assets .public/assets
42+
cp -r .public/patternfly-4/assets .public/assets &&
43+
cp .public/patternfly-4/favicon* .public
4344
no_output_timeout: 30m
4445
- run:
4546
name: Deploy Docs

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,6 @@ jobs:
8686
- yarn build:storybook
8787
- mv .out .public/patternfly-3
8888
- mv packages/patternfly-4/react-docs/public .public/patternfly-4
89+
- cp .public/patternfly-4/favicon* .public
8990
- cp -r .public/patternfly-4/assets .public/assets
9091
- .circleci/conditional_upload.sh

CONTRIBUTING.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ Please ensure that all React UI components contributed meet the following guidel
192192
- When your stories contain multiple files, put them in a subfolder named `Stories`
193193
- `src/**/*.stories.js` and `src/**/Stories/` are excluded from the package build output
194194
- Documentation for PatternFly 4
195-
- Provide documentation for your component with examples in the component's example directory. examples (e.g `Listgroup/examples/SimpleListGroup.js`)
196-
- All examples should be added to the component's documentation file (`ComponentName.docs.js`) exports.
197-
See the getting started guide for more information on [Adding documentation](./GETTING-STARTED.md#adding-component-documentation)
195+
- Provide documentation for your component with a single Markdown file. (e.g., `ListGroup.md`)
196+
See how to write documentation in the [`react-docs` README](./packages/patternfly-4/react-docs/README.md)
198197
- When writing a component and you want to use the classnames package, be sure to import and name it `classNames`. For example - `import classNames from 'classnames'`
199198
- When destructuring or spreading expressions , use ...props as the variable name.
200199
- Exporting components from other libraries (without manipulating them)
@@ -256,9 +255,7 @@ $ git checkout -b my-branch -t upstream/master
256255
index.js - Barrel File exporting public exports
257256
ComponentName.js - Component Implementation
258257
ComponentName.test.js - Component Tests
259-
ComponentName.docs.js - Component Docs
260-
examples/ - dir for all examples
261-
SimpleComp
258+
ComponentName.md - Component Docs
262259
```
263260

264261
4. Develop your component. After development is complete, ensure tests and lint standards pass.

GETTING-STARTED.md

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,16 @@ After you have written your new PatternFly component, tests, and Storybook stori
1818

1919
## PatternFly React Doc
2020

21-
PatternFly 4 React uses Gatsby. Examples are created toe demonstrate of the use of the React components. Documents are generated from these examples.
22-
23-
### Adding Component Documentation
24-
25-
Component Documentation has two parts. a `[Component].docs.js` file, and files under `[Component]/examples/`. Each file must follow a few guidelines for them to be consumed properly by the docs website.
26-
27-
The `docs.js` file has the following structure
28-
29-
```js
30-
import SimpleExample from './examples/SimpleComponent';
31-
import { Component, ComponentSize } from '@patternfly/react-core'; // only @patternfly/react-* imports are allowed
32-
33-
export default {
34-
title: 'Component', // Title to display at the top of the docs page
35-
description: 'description', // Opening description for the component
36-
components: {
37-
Component: Component // Key value pair for components to include prop documentation
38-
},
39-
enumValues: {
40-
// Optional
41-
ComponentSize: Object.values(ComponentSize) // key value pair for any enums that cannot be statically analyzed.
42-
},
43-
examples: [SimpleExample] // Array of examples to include on the page. They must be stored under /examples/
44-
};
45-
```
46-
47-
An example file has the following structure
48-
49-
```jsx
50-
import React from 'react';
51-
import { Component } from '@patternfly/react-core'; // only @patternfly/react-* imports are allowed
52-
import something from './common/something'; // any directory under examples/ is ignored in page generation.
53-
import styles from './Example.styles.js'; // any .styles.js file under examples/ is ignored in page generation
54-
55-
// note: this can be a function too with the title, etc, set similar to setting Component.propTypes
56-
class Example extends React.Component {
57-
static title = 'Simple Example'; // Sets the examples title
58-
static description = 'description'; // Optional: Extra description for the example
59-
static getContainerProps = () => ({
60-
// Optional: Adds any extra props to the container. Useful for example specific styles
61-
style: styles
62-
});
63-
64-
render() {
65-
return <Component />;
66-
}
67-
}
68-
69-
export default Example;
70-
```
21+
PatternFly 4 React uses Gatsby. Examples are created to demonstrate of the use of the React components. Documents are generated from these examples.
22+
See how to write documentation in the [`react-docs` README](./packages/patternfly-4/react-docs/README.md)
7123

7224
Some things to keep in mind when writing examples:
7325

7426
1. Keep them simple. It is much easier for a person to understand what is going on.
7527
1. Do not do any iteration of variants, sizes, etc in the render. This is easier for the developer, but it makes it much harder to reason for the consumer.
76-
1. Keep anything you think is useful inside this file. The source view (coming soon) will only include the source of the example. If everything is broken out it will not be useful to the consumer. Remember, you are writing examples not a super optimized application.
7728
1. Try not to add extra external dependencies. These will only be approved on a case by case basis.
29+
1. You are unable to use experimental language features like [class properties](https://babeljs.io/docs/en/babel-plugin-proposal-class-properties) as [Buble](https://github.com/bublejs/buble) does not support them.
30+
1. The easiest way to develop your example is by creating an empty code block and then editing it in your browser. Once your happy, copy the code back to your Markdown file.
7831

7932
## Testing
8033

packages/patternfly-4/react-charts/src/components/AreaChart/AreaChart.docs.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/patternfly-4/react-charts/src/components/AreaChart/examples/CustomColorsChart.js

Lines changed: 0 additions & 81 deletions
This file was deleted.

packages/patternfly-4/react-charts/src/components/AreaChart/examples/DarkGreenThemeChart.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

packages/patternfly-4/react-charts/src/components/AreaChart/examples/SimpleChart.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

packages/patternfly-4/react-charts/src/components/AreaChart/examples/common/getContainerProps.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/patternfly-4/react-charts/src/components/AreaChart/examples/common/getContainerPropsDark.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)