Skip to content

Commit ec0d60e

Browse files
committed
docs: update README.md
1 parent 1fb4952 commit ec0d60e

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,120 @@
11
# react-notion-avatar
22

3+
<div align="center">
4+
<img src="https://cdn.jsdelivr.net/gh/miqilin21/static@master/img/example.gif" alt="imagewall" />
5+
</div>
6+
7+
## Assets
8+
9+
- Designer: [@Felix Wong](https://www.producthunt.com/@felix12777) on ProductHunt
10+
- Pack of illustrations: [Noto avatar](https://abstractlab.gumroad.com/l/noto-avatar)
11+
12+
## Installation
13+
14+
```sh
15+
npm install react-notion-avatar
16+
```
17+
18+
or
19+
20+
```sh
21+
yarn add react-notion-avatar
22+
```
23+
24+
## Usage
25+
26+
1. Import the component.
27+
```js
28+
import NotionAvatar from 'react-notion-avatar'
29+
```
30+
2. Set the config attribute, so that you can always rendering a same avatar with the configuration.
31+
```js
32+
const config = {
33+
eye: 3,
34+
eyebrow: 3,
35+
face: 4,
36+
glass: 1,
37+
hair: 1,
38+
mouth: 2,
39+
nose: 3,
40+
accessory: 0,
41+
beard: 0,
42+
detail: 0,
43+
}
44+
```
45+
46+
`tip`: config is an Object, please check the **Attributes** below for what attributes can be passed in.
47+
48+
`Note`: If you don't set the config attribute, component will generate a random avatar.
49+
50+
3. Render the component with specific width / height and configuration.
51+
```jsx
52+
<NotionAvatar style={{ width: '6rem', height: '6rem' }} {...config} />
53+
```
54+
or
55+
56+
```jsx
57+
<NotionAvatar className="className" {...config} />
58+
```
59+
or
60+
```jsx
61+
<NotionAvatar />
62+
```
63+
64+
## Attributes
65+
66+
The Attributes can be passed into config
67+
68+
| key | type | default | accept |
69+
| ----------------- | ------- | ------- | --------- |
70+
| `face` | number | | 0~10 |
71+
| `eye` | number | | 0~10 |
72+
| `eyebrow` | number | | 0~10 |
73+
| `glass` | number | | 0~10 |
74+
| `hair` | number | | 0~30 |
75+
| `mouth` | number | | 0~10 |
76+
| `nose` | number | | 0~10 |
77+
| `accessory` | number | 0 | 0~10 |
78+
| `beard` | number | 0 | 0~10 |
79+
| `detail` | number | 0 | 0~10 |
80+
81+
or as React props
82+
83+
| key | type | tips |
84+
| ----------------- | ------- | ---------------------------------- |
85+
| `id` | string | Only for React Props |
86+
| `className` | string | Only for React Props |
87+
| `style` | object | Only for React Props |
88+
89+
## Development
90+
91+
1. Clone the repo:
92+
```sh
93+
$ git clone git@github.com:miqilin21/react-notion-avatar.git
94+
$ cd react-notion-avatar
95+
```
96+
2. Install dependencies:
97+
```sh
98+
$ yarn
99+
```
100+
Or
101+
```sh
102+
$ npm install
103+
```
104+
3. Start the server for the example:
105+
```sh
106+
$ yarn dev
107+
```
108+
Or
109+
```sh
110+
$ npm run dev
111+
```
112+
4. Open the browser to reivew the example:
113+
```sh
114+
$ open http://localhost:8080
115+
```
116+
5. Edit the files inside [src](/src).
117+
118+
## License
119+
120+
Released under [MIT](/LICENSE) by [@miqilin21](https://github.com/miqilin21).

0 commit comments

Comments
 (0)