@affinidi/ui-core
v1.8.0
Published
The common UI library for affinidi
Downloads
25
Keywords
Readme
UI Core
This is the Affinidi Core UI library. Exports a bunch of components and hooks for themeing their every aspect.
Made using React, SCSS for the components, Storybook for Documentation and rollup for bundling
Installation
$ npm i @affinidi/ui-core
Usage
Components
import {Button} from '@affinidi/ui-core'
const MyComponent = () => {
return (
...
<Button>Click Me!</Button>
...
)
}
Palette Override
import { useUICoreTheme } from '@affinidi/ui-core'
const MyComponent = () => {
useUICoreTheme({
palette: {
primary: {
main: "darkblue"
}
}
})
return (
...
)
}
Local Development
The library uses yalc for local development, bundling and testing. Make sure your machine has yalc installed by running npm i -g yalc
The following steps illustrate how to develop and test your local changes
- Do the required changes to the codebase. This can be creating new components(or updating older ones), writing hooks or any other changes that will affect the functioning of the library and ultimately the consumers
- Run
npm run publish-local
from the project root. This will run the build script and package the library intoyalc
's local registry acting like a pseudo npm store - To test your changes in another library go to the consumer and run
yalc add @affinidi/ui-core
. This will create a local.yalc
folder and ayalc.lock
file to keep track of this local package. Then follow the usage guidelines above to test. We rinse and repeat till done. - Once we're ready to commit we can cleanup the consumer by running
yalc remove @affinidi/ui-core
and removing the created files and folders from the previous step. - Proceed with the commit.
Browsing Storybook
We dont host our storybook(yet), so one can clone the repository and browse through locally.
cd ui-core
npm i
npm run storybook
Documentation
All components have dedicated typings available but more concrete documentation would be available soon