The following structure is the basic structure for a component.
wix-style-react
|
|__src
| |__ComponentName
| | index.js # entry file for the component
| | ComponentName.js # the actual component
| | ComponentName.scss # the component stylesheet
| | ComponentName.spec.js # component tests
| | ComponentName.driver.js # vanilla js public driver to abstract common actions
| | ComponentName.e2e.js # browser testing
| | ComponentName.protractor.driver.js # protractor public driver to abstract common actions
| | README.md # (optional) additional information of the component
| | README.TESTKIT.md # documention for the different driver methods
| | README.DESIGN-SPEC.md # Component specification
|__stories
| |__ComponentName
| | index.story.js # entry file for all component documentation
- Every component should have an index file exporting the default entry for easy importing.
- The actual component. A component can be either a simple standalone component or composition of other components.
- Read the Component Guidelines section for more information.
- Almost every component will have a styling sheet.
- Read the Styling section for more information.
- Testing component behavior and methods wiring.
- Read the Tests section for more information.
- Every component exposes a public driver abstraction over common interactions. It is used also in the component tests in order to verify it works.
- Read the Test Drivers section for more information.
- Actual browser tests for the component.
- Read the Tests section for more information.
- Same as the
ComponentName.driver.js
only with protractor syntax. - Read the Test Drivers section for more information.
- The documentation of every component. It uses the
.story
convention in order to apply automated documentation tool. - Read the Component Documentation section for more information.
This documents purpose is for planning the implementation of a new component. It is not a place for documentation (for consumers). Component specification, may include:
- Reference to UX spec
- Props API definitions
- Styling API definitions
- Detailed behavior definitions
- Implementation details
See this COMPONENT-SPEC-TEMPLATE
Each component has also an "entry" in a few common files.
wix-style-react
|
|__.storybook
| |__stories.js # loads all stories
|__testkit
| |__index.js # all vanila drivers
| |__enzyme.js # all enzyme drivers
| |__protractor.js # all protractor drivers
| |__puppeteer.js # all puppeteer drivers
When adding a new component, you need to also add an entry in each of these files.