Contributing to Library
All contributions are welcome, please follow the guide below to get started
Getting Started #
This project uses Storybook as it's development environment for both React Native and the web. Storybook has it's own simple webserver to run the web components, but the project uses a bare React Native app to run it's components and the Storybook environment.
The main project folders are as follows:folder
description
.storybook
storybook config
docs
documentation site
public
storybook web files
src
component library
root of the folder, and all documtation files live in the docs folder.Setup #
You can follow the React Native Docs to get React Native installed if you need to. Once you have React Native set up, follow these steps to get the project set up:
- Fork material-bread repo on github
- Clone the fork to your machine
git clone git@github.com:copypearce/material-bread.git - Cd into project
cd material-bread - Install dependencies by running
npm ioryarn - Start up react native app by running
react-native run-iosorreact-native run-android - Start up web project by openning a new terminal tab and running
npm run storybook-web
localhost:9009 .Developing #
Components all live in
Use the following steps to create a new component:src/Components , and they're displayed in the dev environment in a corresponding file src/storybook/stories/index .- Create a basic component folder and file in
src/Components/ComponentNamenamedComponentName.js. - Import
withThemeand Wrap component in the HOC theme component as suchexport default withTheme(ComponentName); - Add component to
src/index.jsas suchexport { default as ComponentName } from './Components/ComponentName/ComponentName'. - Create component file in
src/Components/ComponentName.stories.jsas shown in the other files - Add component story to
src/storybook/stories/indexas suchexport { default as ComponentName } from '../Components/ComponentName/ComponentName.stories.js'.
Storybook Docs #
The storybook environment houses all of the components for development, but its also used in the docs to display more variations. This means the storybook stories you write will appear in the docs for users to play with. For more information about writing storybook stories, refer to storybook documentation