@engagio/engagio-ui
v2.2.0
Published
Engagio Component Library
Downloads
153
Maintainers
Keywords
Readme
EngagioUI
Usage
EngagioUI is a private repo. In order to use EngagioUI in other projects, you must have an npm account (See Raj or Pushkar if you do not have an account) and do the following:
$ sudo npm login
- Enter your npm credentials (Note: First
Password:
request is your device password.) $ npm i @engagio/engagio-ui
You should now be able to require EngagioUI components. Example:
import {Button} from '@engagio/engagio-ui';
const CancelButton = (
<Button>
{'Cancel'}
</Button>
);
Components
- Button
- Toggle (coming soon)
- Icon (coming soon)
Contributing
File Structure
All components have their own directory with index.js
, ${COMPONENT_NAME}.js
, and ${COMPONENT_NAME}.scss
. The file structure is purposefully flat to avoid circular dependencies.
SCSS/CSS
Currently, all styles are written in scss. Component specific scss are within the same directory as the component (See "File Structure" above). However, the scss files are transpiled into css in order to eliminate the need to do the transformation outside of EngagioUI. This may be confusing since the styles are written as scss, but in the component, we are importing css files. (i.e. import Button.css
)
Versioning
Versioning should follow Semantic Versioning standards (http://semver.org/)
Developing Locally
-To test if component works in the web app before publishing-
- if not yet in home directory, cd out of current folders.
brew install watchman
npm install -g wml
wml add ~/engagio-ui ~/engagio/web/node_modules/@engagio/engagio-ui
(it will require you to hit Y twice)wml start
(this will start watching for changes locally as well and copy over changed files)cd engagio-ui
npm run build:dev
- all local changes should be updated in the web/node_modules as updated, then you can use web/app to test your local changes.
Alternative Linking method
- Navigate to engagio-ui repo
npm link
yarn build
- Navigate to engagio/web
npm link @engagio/engagio-ui
- Start the dev proxy server
Running the Demo Page
- build the library
npm run build
(ornpm run build:watch
if developing) cd docs/
yarn install
yarn start
- Open browser
localhost:3003/
Publishing
- go to root directory
- build the library
yarn build
- bump the version number up in Package.json
npm publish
- Remember to also bump the version number up in our engagio directory.
- Note that files/directories that should be ignored are in the
.npmignore
file. If more directories are added for development, add them to this file or else they will be published with the package.
Best Practices
All code should conform to the Front End Best Practices
Code Validation
Code validation runs through:
- linting
- flow checking
- testing (with coverage)
$ yarn validate
Linting
Linting uses eslint and eslint-react-plugin
$ yarn lint
or $ yarn lint:watch
to watch files while deving
FlowJS
Flow is a static type checking tool written by Facebook
$ yarn flow
Testing
Tests are written using Jest
$ yarn test
Tests are leveraging jest snapshots. This means that when a snapshot is out of date, it needs to be updated.
- Install jest-cli:
npm install -g jest-cli
- A test needs to be updated because it failed the snapshot:
jest -t AccountHighlight -u
Coverage
$ yarn test:coverage
- open
/coverage/lcov-report/index.html
in your browser