Skip to content

Commit

Permalink
Merge pull request #238 from Hipo/next-release
Browse files Browse the repository at this point in the history
v1.1.2 Release
  • Loading branch information
jamcry authored Mar 26, 2024
2 parents 45c14f4 + 6a6ab09 commit d5c2f06
Show file tree
Hide file tree
Showing 9 changed files with 1,215 additions and 97 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.0.0

Expand All @@ -24,7 +24,7 @@ jobs:
run: npm run build

- id: publish-to-npm
uses: JS-DevTools/npm-publish@v1
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }} # This token should be added from repo settings

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18

- name: Install dependencies and build storybook
run: |
Expand Down
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.
Loading

0 comments on commit d5c2f06

Please sign in to comment.