@zenginehq/zengine-ui-react
v0.21.0
Published
Zengine UI React
Downloads
15
Readme
Zengine UI React
Atomic design Components for Zengine Plugins built in React.
Installation
npm i @zenginehq/zengine-ui @zenginehq/zengine-ui-react
Running Storybook
npm run storybook
Publishing Changes
npm postpublish
Usage
Add Font Awesome Icons
In index.html or equivalent:
<script src="https://kit.fontawesome.com/0cf0825a47.js" crossorigin="anonymous"></script>
Import and Use
In your component.js file:
// Add styles. In the future this might be available on a CDN, for now include it locally.
import '@zenginehq/zengine-ui/style.css';
// Use components.
import { Button, TextField, NumberField, Form } from '@zenginehq/zengine-ui-react';
// Tree-shaking friendly imports also available.
import Button from '@zenginehq/zengine-ui-react/lib/atoms/Button';
function MyComponent() {
const myCallback = values => {
console.warn('submitted values', values);
};
return (
<Form onSubmit={myCallback}>
<TextField name="firstName" label="First Name" required />
<NumberField name="age" label="Age" required />
</Form>
);
}
For more information see the Storybook.
Explanation of NPM scripts
storybook
: starts the local dev version of the Storybooktest
: starts the Jest interactive test runnertest:save
: runs tests in CI mode (non-interactive just run all tests once) and logs output to a filetest:cover
: runs tests in CI mode (see test:save) and generates code a coverage report (only considersapi
folder)storybook:build
: runs tests to generate the log output and builds the Storybookstorybook:publish
: deploys the Storybook to Github Pagesbuild
: builds the redistributable output for Zengine UI React; this is what people will get when theynpm install
this in their projectsbuild:js
: helper script to build JS artifacts, gets called bynpm run build
build:css
: helper script to build CSS artifacts, gets called bynpm run build
- 'postpublish': 'test build and publish all in one command'
Directory Structure Guide
.cache
is an internal directory used by React, ignore it.storybook
contains Storybook configurationlib
is where the generated package code goes whennpm run build
is executed; this directory won't exist unless you've run the commandpublic
contains static assets to be served with the Storybooksrc
contains the actual Zengine UI React source codestorybook-static
is where the generated Storybook code whennpm run build-storybook
is executed; this directory won't exist unless you've run the command