Clone and run ./bin/setup
.
cd docs-src
npm run develop
This will open up a new browser tab at localhost:8000. While this is running you can make changes in the src folder and the site will automatically reload with your changes.
From time to time, you may need to run npm run build
in the root harmonium
directory to rebuild the lib/
directory as you change components.
- Write a component like
src/my-component.js
. - Write an example file like
docs-src/src/examples/my-component.js.example
.- The module should have one or more named exports that are React components, defined with ES6 class syntax. (
export class Example1 extends Compnent {}
) - Each example will be built into the docs site.
- The module should have one or more named exports that are React components, defined with ES6 class syntax. (
- Import your component into
docs-src/src/ExampleScope.js
- Write a test file like
src/my-component.test.js
.- Run tests with
npm test
. - See
test-config.js
to see what additional globals are available in tests. (expect
,shallow
,mount
, etc.)
- Run tests with
- Create a new folder in
/docs-src/src/pages/components called ComponentNameTables
- Create a new file in that folder called
ComponentNameVars.js
- Table Markup:
<Table>
<Table.Head>
<Table.Row>
<Table.Header>Variable Name</Table.Header>
<Table.Header>Default Value</Table.Header>
<Table.Header>Description</Table.Header>
</Table.Row>
</Table.Head>
<Table.HeadStacked>
<Table.Data>[ComponentName] Vars</Table.Data>
</Table.HeadStacked>
<Table.Body>
<Table.Row>
<Table.Data>
<Table.HeaderInline>Var:</Table.HeaderInline> [Var]
</Table.Data>
<Table.Data>
<Table.HeaderInline>Default Value:</Table.HeaderInline> [Var Default]
</Table.Data>
<Table.Data>
<Table.HeaderInline>Description:</Table.HeaderInline> [Var Desc.]
</Table.Data>
</Table.Row>
</Table.Body>
</Table>
- Make sure to check the harmonium-settings.scss file for any vars that were not listed at the top of the components stylesheet.
- Import the ComponentNameVars file into the main example page:
/docs-src/src/pages/components/ComponentName.js
- After the
ExampleSection
include<h3>Variables:</h3>
- Then call in the table:
<ComponentNameVars />
- If you haven't already, create a new folder in
/docs-src/src/pages/components called ComponentNameTables
- Create a new file in the
ComponentNameTables
folder calledComponentNameProps.js
- Table details:
<Table>
<Table.Head>
<Table.Row>
<Table.Header>Name</Table.Header>
<Table.Header>Type</Table.Header>
<Table.Header>Default</Table.Header>
<Table.Header>Description</Table.Header>
</Table.Row>
</Table.Head>
<Table.HeadStacked>
<Table.Data>[ComponentName] Props</Table.Data>
</Table.HeadStacked>
<Table.Body>
<Table.Row>
<Table.Data>
<Table.HeaderInline>Name:</Table.HeaderInline> [prop]
</Table.Data>
<Table.Data>
<Table.HeaderInline>Type:</Table.HeaderInline> [PropType]
</Table.Data>
<Table.Data>
<Table.HeaderInline>Default:</Table.HeaderInline> [Prop Default]
</Table.Data>
<Table.Data>
<Table.HeaderInline>Description:</Table.HeaderInline> [Prop Desc.]
</Table.Data>
</Table.Row>
</Table.Body>
</Table>
- Include all possible props (also check the components file to make sure you didnt miss any props that were not listed on the site.)
- Import the ComponentNameProps file into the main example page:
/docs-src/src/pages/components/ComponentName.js
- After the Variables section include
<h3>Properties:</h3>
- Then call in the table:
<ComponentNameProps />
When creating a new component, new styles will likely be needed. Follow the steps below to ensure you have updated all the necessary files.
- Add an SCSS file like
scss/components/_ComponentName.scss
- Update
scss/components/_components.scss
so that it imports your new component's style sheet. - New variables should be at the top of the component's style sheet (
_ComponentName.scss
) with!default
tags. - Add component vars to
/harmonium/settings-templates/harmonium-component-settings.scss
. Remove any!default
tags
- Fork the repository.
- Set up the gem per the instructions above and ensure
npm test
runs cleanly. - Create a topic branch.
- Add tests for your unimplemented feature or bug fix.
- Run
npm test
. If your specs pass, return to step 4. - Implement your feature or bug fix.
- Re-run
npm test
. If your specs fail, return to step 6. - Thoroughly document and comment your code.
- Add a usage example as src/ComponentName.example.js
- Run
cd docs-src && npm run develop
and make sure your example loads and looks like you expect. - Add, commit, and push your changes.
- Submit a pull request.
The design tokens help us define our style variables in one spot. The /design-tokens
directory is where design token values should be updated. Once you update a design token, you will need to run npm run build
to generate all of these files:
Building design token output
scss
✔︎ ./settings-templates/_harmonium-settings.scss
✔︎ ./settings-templates/_color-palette.scss
scss-defaults
✔︎ ./scss/vars/_design-token-defaults.scss
✔︎ ./scss/vars/_color-palette-defaults.scss
docs
✔︎ ./docs-src/designTokens.js
js
✔︎ ./settings-templates/harmonium-tokens.js
Building settings-templates.zip
which are nessesary for for the doc site, the styles included in harmonoium, as well as the downloadable harmonium settings.