- Yeoman globally installed
- Run
yarnin your project root folder
We provide a yeoman generator that requires 2 clicks to create a new pattern.
- Install the generator:
npm install -g generator-apparena-patternoryarn global add generator-apparena-pattern cdinto the App-Arena patterns root directory (it contains a.yo-rc.jsonfile)- Run the generator:
yo apparena-pattern - Follow the onscreen prompts
- Overwrite the file source/patterns/index.js if prompted (make a backup of your changes!)
Done! Now edit your newly created pattern under source/patterns/...
- Add a new
docs/directory to the pattern if there isn't one already - Create a new markdown file (*.md) with the same name as the pattern directory if it doesn't exist yet (only one per pattern)
- Write any description in markdown format in that file
- Create a new JS file (*.example.js) with the same name as the pattern directory if it doesn't exist yet (only one per pattern)
- Create a working react pattern inside the *.example.js file
A working example (a button):
The .example.js file for the button looks like this:
import React from 'react';
import {Button} from 'apparena-patterns-react';
export default function ButtonExample() {
return (
<div>
<Button type="primary">
Primary
</Button>
<Button type="secondary">
Secondary
</Button>
<Button type="link">
Link
</Button>
</div>
);
}This file will then be inserted in the documentation where the user can optionally inspect the source code as well. The markdown file for the pattern should cover these two questions at least:
- What problem does this solve?
- When and how to use this pattern?
By answering these two questions in your markdown file a user of the patterns should be able to tell whether he needs the pattern and how to use it.