A react library developed with dumi.
Use a fresh dev environment in Gitpod by pressing the code now[] badge above.
On your local machine you can prepare your dev environment as follows. From CLI in root of the project run:
npm i
npm start
To add a component to this library, follow these steps using the Button component as an example:
-
Create dirs and files:
- path/to/src/Button
- index.zh-CN.md
--- title: 按钮 group: title: 通用型组件 order: (OPTIONAL) --- # 按钮 这是一个按钮实例。 ```tsx import { Button } from 'byte-design'; export default () => <Button content="按钮" /> ```
- index.en-US.md
--- title: Button group: title: General order: (OPTIONAL) --- # Button This is an example button. ```tsx import { Button } from 'byte-design'; export default () => <Button content="test" /> ```
- index.tsx
import React from 'react'; import './style.scss' const Button: React.FC<{ content: string }> = (props) => { return ( <button className="test">{props.content}</button> ) }; export default Button;
- style.scss
@import '../variables.scss'; .test { background-color: white; } .test:active { background-color: seagreen; color: white; } .test { width: 200px; }
- index.zh-CN.md
- path/to/src/Button
-
Export the new component in
path/to/src/index.ts
:export { default as Button } from './Button';
These steps provide a basic framework for adding a new component. After completing them, you can continue with your further development.
This project is created using npx create-dumi
, which is suggested by dumi.
Currently, some changes have happened in the following dirs/files:
- src
- docs
- .dumirc.ts
- .gitpod.yml
- package.json
TODO
TODO
# install dependencies
$ npm install
# develop library by docs demo
$ npm start
# build library source code
$ npm run build
# build library source code in watch mode
$ npm run build:watch
# build docs
$ npm run docs:build
# check your project for potential problems
$ npm run doctor
MIT