Skip to content

Commit

Permalink
update readme and package version
Browse files Browse the repository at this point in the history
  • Loading branch information
jamcry committed Mar 25, 2024
1 parent 3637c38 commit 9d47c6e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 23 deletions.
69 changes: 50 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 9d47c6e

Please sign in to comment.