plurall-components v0.0.26
Plurall React Componetes
How to run
Clone this repository and cd plurall-react-components
The first time you need run
yarn && yarn buildTo run project
yarn bootstrap && yarn startif yout development components or new component you nedd run this in other terminal tab
yarn start:watchto publish in npm
export NPM_TOKEN=token-do-plurall-dev
yarn deployopen localhost:6006/
Using components locally
To test a component locally in an external application, uninstall the component and reinstall it pointing to the location on your machine where the component source code is located.
For exemple, if you cloned the repository inside a folder called projects and
want to test locally the Header component, run
npm uninstall plurall-header
npm install --save ~/projects/plurall-react-components/packages/plurall-component-headerYour package.json will be updated, and will now fetch the component from your
local disk, instead of a remote repository:
"plurall-header": "file:../plurall-react-components/packages/plurall-component-header"Create a new component
- Create a new folder in
/packages/with this formatplurall-component-nomeComponent - run
npm initfor create a new component -Follow the steps to create or look at the button, for example. - Create a
srcfolder inside Crate a
index.jsFor example:
import YourComponetName from './YourComponetName'; export { YourComponetName, };
Create a
YourComponetName.jsFor Example
import React from 'react' import PropTypes from 'prop-types' class YourComponetName extends React.Component { render() { const { children } = this.props; return ( <div> {children} <style jsx>{` div { color: red } `}</style> </div> ); } } YourComponetName.propTypes = { children: PropTypes.node }; export default YourComponetName
Now goto
stories/index.jsand add new component, for example:
import { MyComponent } from '../packages/plurall-component-YourComponetName/src'
storiesOf('MyComponent', module)
.addWithInfo('Default', () => (
<MyComponent />
))7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago