Skip to content
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
79 changes: 37 additions & 42 deletions samples/groupchannel/package-lock.json

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

2 changes: 1 addition & 1 deletion samples/groupchannel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"react": "17.0.0",
"react-dom": "17.0.0",
"react-scripts": "3.0.1",
"sendbird-uikit": "2.5.0"
"@sendbird/uikit-react": "3.0.0-beta"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
Expand Down
4 changes: 2 additions & 2 deletions samples/groupchannel/src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { SendBirdProvider as SBProvider } from "sendbird-uikit";
import "sendbird-uikit/dist/index.css";
import SBProvider from "@sendbird/uikit-react/SendbirdProvider";
import "@sendbird/uikit-react/dist/index.css";

import CustomizedApp from "./CustomizedApp";
import "./styles.css";
Expand Down
10 changes: 4 additions & 6 deletions samples/groupchannel/src/CustomizedApp.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { useState, useCallback } from "react";

import {
Channel as SBConversation,
ChannelList as SBChannelList,
ChannelSettings as SBChannelSettings,
withSendBird
} from "sendbird-uikit";
import SBConversation from '@sendbird/uikit-react/Channel';
import SBChannelList from '@sendbird/uikit-react/ChannelList';
import SBChannelSettings from '@sendbird/uikit-react/ChannelSettings'
import withSendBird from '@sendbird/uikit-react/withSendBird';

function CustomizedApp(props) {
// default props
Expand Down
103 changes: 103 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# sendbird-uikit

<img alt="Version 3 beta" src="https://img.shields.io/badge/beta-v3-orange" />

> React based UI kit based on sendbird javascript SDK

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).

## Getting Started

With Sendbird UI Kit React, we export these components:
(See `src/index.jsx`)

* SendBirdProvider - The context provider for SDK component
* useSendbirdStateContext - Hook to access SendBirdProvider context
* sendBirdSelectors - A bunch of useful selectors that can be used along with *useSendbirdStateContext*

* Channel - A UI Component where conversations happen
* ChannelList - A ChannelList UI component
* ChannelSettings - A component to handle the settings of a given channel
* MessageSearch - To search for a message from a Channel
* OpenChannel - A UI Component where open channel conversations happen
* OpenChannelSettings - A component to handle the settings of a given channel
And many more...

* 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

> Note 1: Dont forget to import the stylesheet from the repo too
> 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

### Prerequisites

You need to install:
* nodejs 14 LTS https://nodejs.org/en/download/
* npm 7 or above

```
npm 14 deprecated warnings for fsevents& chokidar@2.1.8 will be fixed when storybook is updated to webpack 5
https://github.com/storybookjs/storybook/issues/12425#issuecomment-723043137
```

We tried development on Mac OS / Linux systems. You might encounter problems in running `npm run build` in Windows machines

### Development

We use storybook for development and rollup for building the npm distribution(bundled JS file)
Make sure you have nodejs and npm installed and run

```
Make a copy of env.example and save it as .env
Set your appId STORYBOOK_APP_ID
npm install
npm run storybook
```
> `npm run generate-component` generates a UI component skeleton in `src/ui`

* By default, storybook opens in http://localhost:6006/
* Smart Components such as ChannelList, Channel, ChannelSetting, App can be found under `OTHERS`
* Dumb components such as inputs, buttons etc can be found under `OTHERS/UI Components` in storybook sidebar
* Overridden storybook configs can be found in: `./storybook`

### Build

We use rollupJS for building the production bundle script that you want to use inside your applications.

We have both esm and commonjs output

```
npm run build
```

The bundled JS code can be found in `./release`
The CSS is in `./release/dist/index.css`

## Running the tests

We have implemented tests for dumb ui components only. Technologies used: Jest, Enzyme and react-dom/test-utils

```
npm run test
```

### Lint

```
npm run lint
```
* .eslintrc.json lints ts files and .eslintrc.js lints js files


### Typescript

* 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
* .eslintrc.json lints ts files and .eslintrc.js lints js files
* Type definition file can be `src/index.d.ts` which will be copied to `/release` directory

### Creating/exporting new components

1. Define your component inside './src'
2. Add the following line to './src/index.js'
`export NewComponent from './src/location/of/NewComponent';`
3. Add the following line to './exports.js'
`NewComponent: 'src/location/of/NewComponent',`
106 changes: 106 additions & 0 deletions scripts/package.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"name": "@sendbird/uikit-react",
"version": "{{ version }}",
"description": "React based UI kit for sendbird",
"main": "index.js",
"style": "dist/index.css",
"typings": "index.d.ts",
"module": "index.js",
"devEngines": {
"node": "14.x || 15.x || 16.x"
},
"files": [
"**/*"
],
"scripts": {
},
"repository": {
"type": "git",
"url": "git+git@github.com:sendbird/sendbird-uikit-react-sources.git"
},
"author": "SendBird <support@sendbird.com>",
"license": "SEE LICENSE IN LICENSE.md",
"peerDependencies": {
"css-vars-ponyfill": "^2.3.2",
"date-fns": "^2.16.1",
"prop-types": "^15.7.2",
"react": "^16.8.6 || ^17.0.0",
"react-dom": "^16.8.6 || ^17.0.0"
},
"dependencies": {
"css-vars-ponyfill": "^2.3.2",
"date-fns": "^2.16.1",
"prop-types": "^15.7.2",
"sendbird": "^3.1.4"
},
"bugs": {
"url": "https://community.sendbird.com"
},
"homepage": "https://sendbird.com",
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.10.4",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-eslint": "^8.0.1",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-replace": "^2.4.2",
"@rollup/plugin-typescript": "^8.2.1",
"@storybook/addon-actions": "^6.3.4",
"@storybook/addon-docs": "^6.3.4",
"@storybook/addon-links": "^6.3.4",
"@storybook/addons": "^6.3.4",
"@storybook/preset-scss": "^1.0.3",
"@storybook/react": "^6.3.4",
"@storybook/storybook-deployer": "^2.8.10",
"@svgr/rollup": "^5.5.0",
"@svgr/webpack": "^5.1.0",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "^3.6.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.2",
"autoprefixer": "^9.7.4",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.1.0",
"babel-loader": "^8.0.6",
"browserslist": "^4.14.5",
"caniuse-lite": "^1.0.30001148",
"css-loader": "^3.4.2",
"dts-bundle-generator": "^6.5.0",
"enzyme": "^3.11.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^1.7.0",
"jest": "^27.0.6",
"jsdom": "^16.1.0",
"node-sass": "^6.0.1",
"np": "^7.5.0",
"plop": "^2.5.3",
"postcss": "^8.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2",
"rollup": "^2.53.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-scss": "^3.0.0",
"rollup-plugin-size-snapshot": "^0.12.0",
"sass-loader": "^10.2.0",
"style-loader": "^1.1.3",
"stylelint": "^13.0.0",
"stylelint-config-sass-guidelines": "^7.0.0",
"ts-loader": "^7.0.5",
"tslib": "^2.0.0",
"typescript": "^4.3.5"
},
"browserslist": [
"defaults",
"IE 11"
]
}