Skip to content

Commit 29f8967

Browse files
author
Sravan S
authored
chore: Add info about plop on README (#529)
* Add info about how to generate reducers * Clarify "generating new components" section
1 parent 1174f4a commit 29f8967

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ or
6363
yarn install
6464
yarn storybook
6565
```
66-
> `yarn run generate-component` generates a UI component skeleton in `src/ui`
6766

6867
* By default, storybook opens in http://localhost:6006/
6968
* Smart Components such as ChannelList, Channel, ChannelSetting, App can be found under `OTHERS`
@@ -135,13 +134,27 @@ module.exports = {
135134
```
136135
To read more: https://webpack.js.org/configuration/resolve/#resolvefallback
137136

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).
145158
146159
## Acknowledgments
147160
### LameJS

0 commit comments

Comments
 (0)