|
63 | 63 | yarn install |
64 | 64 | yarn storybook |
65 | 65 | ``` |
66 | | -> `yarn run generate-component` generates a UI component skeleton in `src/ui` |
67 | 66 |
|
68 | 67 | * By default, storybook opens in http://localhost:6006/ |
69 | 68 | * Smart Components such as ChannelList, Channel, ChannelSetting, App can be found under `OTHERS` |
@@ -135,13 +134,27 @@ module.exports = { |
135 | 134 | ``` |
136 | 135 | To read more: https://webpack.js.org/configuration/resolve/#resolvefallback |
137 | 136 |
|
138 | | -### Creating/exporting new components |
139 | | - |
140 | | -1. Define your component inside './src' |
141 | | -2. Add the following line to './src/index.ts' |
142 | | - `export { default as NewComponent } from './src/location/of/NewComponent';` |
143 | | -3. Add the following line to './exports.js' |
144 | | - `NewComponent: 'src/location/of/NewComponent',` |
| 137 | +### Creating/Exporting New Components |
| 138 | + |
| 139 | +1. Define your component inside `./src`. |
| 140 | +2. ~~Add the following line to `./src/index.ts`:~~ |
| 141 | + ``` |
| 142 | + export { default as NewComponent } from './src/location/of/NewComponent'; |
| 143 | + ``` |
| 144 | + - Will be imported as: `import { NewComponent } from '@sendbird/uikit-react';` |
| 145 | + - We don't do this anymore for new components; we prefer fine-grained exports (as in step 3). |
| 146 | +3. Add the following line to `./exports.js`: |
| 147 | + ``` |
| 148 | + NewComponent/SubComponent: 'location/of/NewComponent/SubComponent', |
| 149 | + ``` |
| 150 | + - This component can be imported by the consumer as: `import SubComponent from '@sendbird/uikit-react/NewComponent/SubComponent';` |
| 151 | +4. Add type definitions to `scripts/index_d_ts`. |
| 152 | +
|
| 153 | +### Scaffolding New Components |
| 154 | +
|
| 155 | +1. Use `yarn run generate-component` to generate a UI component in `src/ui`. It uses [Plop.js](https://plopjs.com/) to generate the component. |
| 156 | +2. It can also be used to generate [reducers](/src/utils/typeHelpers/reducers/README.md). |
| 157 | +3. Plop templates are found in [here](/plop-templates). |
145 | 158 |
|
146 | 159 | ## Acknowledgments |
147 | 160 | ### LameJS |
|
0 commit comments