diff --git a/README.md b/README.md index 69fccd8..fa10af9 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ -### @hipo/react-ui-toolkit 🧩 +# @hipo/react-ui-toolkit 🧩 -Hipo's React based UI Toolkit / [Demo](https://react-ui-toolkit.now.sh/) +Bakers' React based UI Toolkit -### Usage +## Getting started -After installing the `@hipo/react-ui-toolkit` package you can start with simple example +First, install the package via npm: + +```bash +npm install @hipo/react-ui-toolkit +``` + +After installing the package you should import the main CSS file to gather the initial styles of the components, and then import the components you want to use in your project.: ```javascript import {FormField, Input} from "@hipo/react-ui-toolkit/dist/Input"; @@ -30,40 +36,65 @@ function LoginForm() { } ``` -### Styling +### How to style components? Every component holds a minimum amount of CSS. You can modify them via the CSS variables. See `_colors.scss` and `_measurement.scss` -Here is a simple example that shows how to customize `Button` and `Input` +Here is a simple example that shows how to customize `Button` and `Input` styles by overriding the default CSS variables: + +```scss +.button { + // Override the default button styles using CSS variables -```css -// _button.css -.primary-button { --button-bg: #989898; --button-color: black; } -// _input.css .input { + // Override the default input styles using CSS variables + --default-border-color: black; } ``` +## Development + +[Storybook](#storybook) is suggested for the development environment. It allows you to see the components in isolation and interact with them. It also supports hot-reloading, i.e. when you change the component, it automatically reloads the component in the browser. + +First of all, you need to install the dependencies, in the project root folder, run: + +```bash +npm install +``` + +> ⚠️ Make sure you are using the exact version of `node` and `npm` that are specified in the `engines` field of [package.json](/package.json) file. Otherwise, you may face some unexpected issues. + ### Storybook -- To run Storybook `npm run storybook` -- To generate Storybook build `npm run storybook:build` +Storybook is a development environment for UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components. + +To run the Storybook development server on your local environment, you can use the following command: + +```bash +npm run storybook +``` + +To generate a static build of the Storybook (usually, you don't need this. This is only necessary when you want to publish it to somewhere), you can use the following command: -### Development +```bash +npm run storybook:build +``` -For recommended `node` and `npm` versions, you can check `package.json` +### Production Build -You can start to development with `npm run dev` command. The command watches for changes and builds the toolkit. If you want to generate a production ready build you can use `npm run build`. +The production deployment is automated by GitHub Actions. Check the [.github/workflows/new-version.yml](/.github/workflows/new-version.yml) file for more information. -Or you can run `npm run storybook` to see the components live. Storybook has own Webpack config that compiles and runs the components. +--- -### Linter +If you need to generate a production ready build for some reason, use: -ESLint and Prettier will handle the linting task. You can set a watcher for `npm run prettify` command in your IDE otherwise you need to run prettier manually or right before the production build it'll automatically runs. +```bash +npm run build +``` -The ruleset can be found in [@hipo/eslint-config-base](https://github.com/Hipo/eslint-config-hipo-base), [@hipo/eslint-config-react](https://github.com/Hipo/eslint-config-hipo-base) +This will generate a `dist` folder that contains the compiled components. diff --git a/package-lock.json b/package-lock.json index 6fc0c53..dc0b61f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@hipo/react-ui-toolkit", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@hipo/react-ui-toolkit", - "version": "1.1.1", + "version": "1.1.2", "license": "ISC", "dependencies": { "@storybook/builder-webpack5": "^6.5.16", diff --git a/package.json b/package.json index 1668704..3f485b6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@hipo/react-ui-toolkit", - "version": "1.1.1", - "description": "React based UI toolkit.", + "version": "1.1.2", + "description": "Bakers Studio's React based UI toolkit.", "main": "dist/index.js", "scripts": { "dev": "./node_modules/.bin/rollup -c -w",