-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(design): Add docs and demo for Switch
- Loading branch information
1 parent
f5a9516
commit aebcb64
Showing
6 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import { Switch } from '@oceanbase/design'; | ||
|
||
const onChange = (checked: boolean) => { | ||
console.log(`switch to ${checked}`); | ||
}; | ||
|
||
const App: React.FC = () => <Switch defaultChecked onChange={onChange} />; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { Switch } from '@oceanbase/design'; | ||
|
||
const App: React.FC = () => ( | ||
<> | ||
<Switch defaultChecked disabled={true} /> | ||
<br /> | ||
<Switch disabled={true} size="small" /> | ||
</> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { Switch } from '@oceanbase/design'; | ||
|
||
const App: React.FC = () => ( | ||
<> | ||
<Switch defaultChecked loading={true} /> | ||
<br /> | ||
<Switch loading={true} size="small" /> | ||
</> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { Switch } from '@oceanbase/design'; | ||
|
||
const App: React.FC = () => ( | ||
<> | ||
<Switch defaultChecked /> | ||
<br /> | ||
<Switch defaultChecked size="small" /> | ||
</> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: Switch 开关 | ||
nav: | ||
title: 基础组件 | ||
path: /components | ||
demo: | ||
cols: 2 | ||
--- | ||
|
||
- 🔥 完全继承 antd [Switch](https://ant.design/components/switch-cn) 的能力和 API,可无缝切换。 | ||
- 💄 定制主题和样式,符合 OceanBase Design 设计规范,比如总是展示上下箭头。 | ||
|
||
## 代码演示 | ||
|
||
<!-- prettier-ignore --> | ||
<code src="./demo/basic.tsx" title="基本"></code> | ||
<code src="./demo/size.tsx" title="大小"></code> | ||
<code src="./demo/disabled.tsx" title="禁用"></code> | ||
<code src="./demo/loading.tsx" title="加载中"></code> | ||
|
||
## API | ||
|
||
- 详见 antd Switch 文档: https://ant.design/components/switch-cn |