@sendbird/uikit-react 3.0.0-alpha.2 → 3.0.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -0
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# sendbird-uikit
|
|
2
|
+
|
|
3
|
+
<img alt="Version 3 beta" src="https://img.shields.io/badge/beta-v3-orange" />
|
|
4
|
+
|
|
5
|
+
> React based UI kit based on sendbird javascript SDK
|
|
6
|
+
|
|
7
|
+
We are introducing a new version of the Sendbird Chat UIKit. Version 3 features a new modular architecture with more granular components that give you enhanced flexibility to customize your web and mobile apps. Check out our [migration guides](MIGRATION_v2-to-v3.md).
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
With Sendbird UI Kit React, we export these components:
|
|
12
|
+
(See `src/index.jsx`)
|
|
13
|
+
|
|
14
|
+
* SendBirdProvider - The context provider for SDK component
|
|
15
|
+
* useSendbirdStateContext - Hook to access SendBirdProvider context
|
|
16
|
+
* sendBirdSelectors - A bunch of useful selectors that can be used along with *useSendbirdStateContext*
|
|
17
|
+
|
|
18
|
+
* Channel - A UI Component where conversations happen
|
|
19
|
+
* ChannelList - A ChannelList UI component
|
|
20
|
+
* ChannelSettings - A component to handle the settings of a given channel
|
|
21
|
+
* MessageSearch - To search for a message from a Channel
|
|
22
|
+
* OpenChannel - A UI Component where open channel conversations happen
|
|
23
|
+
* OpenChannelSettings - A component to handle the settings of a given channel
|
|
24
|
+
And many more...
|
|
25
|
+
|
|
26
|
+
* App - is a full fledged app(group channel) component made by combining the above components so that you dont have to combine all the above components by hand. Also it can be used as an example for composing components to build a chat UI
|
|
27
|
+
|
|
28
|
+
> Note 1: Dont forget to import the stylesheet from the repo too
|
|
29
|
+
> Note 2: Name of some components are different from the directories they are in(example -> Channel component is from Conversation component). Please keep that in mind
|
|
30
|
+
|
|
31
|
+
### Prerequisites
|
|
32
|
+
|
|
33
|
+
You need to install:
|
|
34
|
+
* nodejs 14 LTS https://nodejs.org/en/download/
|
|
35
|
+
* npm 7 or above
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
npm 14 deprecated warnings for fsevents& chokidar@2.1.8 will be fixed when storybook is updated to webpack 5
|
|
39
|
+
https://github.com/storybookjs/storybook/issues/12425#issuecomment-723043137
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
We tried development on Mac OS / Linux systems. You might encounter problems in running `npm run build` in Windows machines
|
|
43
|
+
|
|
44
|
+
### Development
|
|
45
|
+
|
|
46
|
+
We use storybook for development and rollup for building the npm distribution(bundled JS file)
|
|
47
|
+
Make sure you have nodejs and npm installed and run
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Make a copy of env.example and save it as .env
|
|
51
|
+
Set your appId STORYBOOK_APP_ID
|
|
52
|
+
npm install
|
|
53
|
+
npm run storybook
|
|
54
|
+
```
|
|
55
|
+
> `npm run generate-component` generates a UI component skeleton in `src/ui`
|
|
56
|
+
|
|
57
|
+
* By default, storybook opens in http://localhost:6006/
|
|
58
|
+
* Smart Components such as ChannelList, Channel, ChannelSetting, App can be found under `OTHERS`
|
|
59
|
+
* Dumb components such as inputs, buttons etc can be found under `OTHERS/UI Components` in storybook sidebar
|
|
60
|
+
* Overridden storybook configs can be found in: `./storybook`
|
|
61
|
+
|
|
62
|
+
### Build
|
|
63
|
+
|
|
64
|
+
We use rollupJS for building the production bundle script that you want to use inside your applications.
|
|
65
|
+
|
|
66
|
+
We have both esm and commonjs output
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
npm run build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The bundled JS code can be found in `./release`
|
|
73
|
+
The CSS is in `./release/dist/index.css`
|
|
74
|
+
|
|
75
|
+
## Running the tests
|
|
76
|
+
|
|
77
|
+
We have implemented tests for dumb ui components only. Technologies used: Jest, Enzyme and react-dom/test-utils
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
npm run test
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Lint
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
npm run lint
|
|
87
|
+
```
|
|
88
|
+
* .eslintrc.json lints ts files and .eslintrc.js lints js files
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Typescript
|
|
92
|
+
|
|
93
|
+
* We are trying to progressively move our source code to typescript - which means older JS code and newly written TS code will coxist while we migrate older JS code to TS
|
|
94
|
+
* .eslintrc.json lints ts files and .eslintrc.js lints js files
|
|
95
|
+
* Type definition file can be `src/index.d.ts` which will be copied to `/release` directory
|
|
96
|
+
|
|
97
|
+
### Creating/exporting new components
|
|
98
|
+
|
|
99
|
+
1. Define your component inside './src'
|
|
100
|
+
2. Add the following line to './src/index.js'
|
|
101
|
+
`export NewComponent from './src/location/of/NewComponent';`
|
|
102
|
+
3. Add the following line to './exports.js'
|
|
103
|
+
`NewComponent: 'src/location/of/NewComponent',`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta",
|
|
4
4
|
"description": "React based UI kit for sendbird",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"style": "dist/index.css",
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"devEngines": {
|
|
10
10
|
"node": "14.x || 15.x || 16.x"
|
|
11
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"**/*"
|
|
14
|
+
],
|
|
12
15
|
"scripts": {
|
|
13
16
|
},
|
|
14
17
|
"repository": {
|