Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update README #2033

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/bezier-icons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ If you need to validate the icon source component, use the utility function `isB
```tsx
import { isBezierIcon, AllIcon } from '@channel.io/bezier-icons'

function FooIcon() {
return (<svg />)
}

console.log(isBezierIcon(AllIcon)) // true
console.log(isBezierIcon(<svg />)) // false
console.log(isBezierIcon(FooIcon)) // false
```

## Contributing
Expand Down
3 changes: 2 additions & 1 deletion packages/bezier-react/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<link rel="preload stylesheet" href="https://cf.channel.io/asset/font/Inter/inter.css">
<link rel="preconnect" href="https://cf.channel.io" />
<link rel="stylesheet" href="https://cf.channel.io/asset/font/Inter/inter.css" />
45 changes: 32 additions & 13 deletions packages/bezier-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,65 @@ Bezier React is a React components library that implements Bezier design system.
### npm

```bash
npm i @channel.io/bezier-react styled-components@5
npm i -D @types/styled-components@5
npm i @channel.io/bezier-react
```

### yarn

```bash
yarn add @channel.io/bezier-react styled-components@5
yarn add -D @types/styled-components@5
yarn add @channel.io/bezier-react
```

### pnpm

```bash
pnpm install @channel.io/bezier-react styled-components@5
pnpm install -D @types/styled-components@5
pnpm install @channel.io/bezier-react
```

**bezier-react has [styled-components](https://styled-components.com/) as peer dependency** so don't forget to install it.

## Usage

1. Wrap `BezierProvider` at the root of your application.
2. Pass the `foundation` value like `LightFoundation` or `DarkFoundation`.
### 1. CSS import

In order to use bezier-react's styles, you need to import CSS. If you're using the module bundler, you can import CSS directly from within your JavaScript file.

```tsx
import "@channel.io/bezier-react/styles.css"
```

Or if you're not using the module bundler, you can add the CSS directly to your HTML. We recommend referring to your styles file and copy-pasting it. As bezier-react updates, your styles should update with it.

```html
<link rel="stylesheet" href="styles.css" />
```

### 2. Wrap `AppProvider`

Wrap `AppProvider` at the root of your application. If necessary, you can change the theme by specifying the `themeName` property.

```tsx
import React from 'react'
import { createRoot } from 'react-dom/client'
import { BezierProvider, LightFoundation, Text } from '@channel.io/bezier-react'
import { AppProvider, Text } from '@channel.io/bezier-react'

const container = document.getElementById('root') as HTMLElement
const root = createRoot(container)

root.render(
<BezierProvider foundation={LightFoundation}>
<AppProvider themeName="dark">
<Text as="h1">Hello World</Text>
</BezierProvider>,
</AppProvider>,
)
```

### 3. Font import

Import font from CDN of Channel Corp. Or you can import it from [Google Fonts](https://fonts.google.com/specimen/Inter).

```html
<link rel="preconnect" href="https://cf.channel.io" />
<link rel="stylesheet" href="https://cf.channel.io/asset/font/Inter/inter.css" />
```

## Contributing

See [contribution guide](https://github.com/channel-io/bezier-react/wiki/Contribute).
Expand Down