@@ -2,15 +2,16 @@ import React from 'react';
22import { Switch , Divider , Button } from 'uiw' ;
33import Markdown from './Markdown' ;
44import GithubCorner from './GithubCorner' ;
5- import CodePreview from '../src' ;
65import DocumentStr from '../README.md' ; // @ts -ignore
6+ import CodePreview from '../src' ;
77import styles from './App.module.less' ;
88
99const code = `import { Button, Divider, Icon } from 'uiw';
1010
1111ReactDOM.render(
1212 <div>
1313 <Button type="primary">主要按钮</Button>
14+ <Button type="dark">暗按钮</Button><br /><br /><br /><br /><br /><br />
1415 <Button type="dark">暗按钮</Button>
1516 </div>,
1617 _mount_
@@ -20,14 +21,18 @@ ReactDOM.render(
2021interface IAppState {
2122 bgWhite : boolean ;
2223 noCode : boolean ;
24+ noScroll : boolean ;
2325 noPreview : boolean ;
26+ bordered : boolean ;
2427}
2528
2629export default class App extends React . PureComponent < { } , IAppState > {
2730 public state = {
2831 bgWhite : false ,
2932 noCode : false ,
33+ noScroll : false ,
3034 noPreview : false ,
35+ bordered : true ,
3136 }
3237 private handleChange ( keyName : string , e : React . ChangeEvent < HTMLInputElement > ) {
3338 const state = { ...this . state , [ `${ keyName } ` ] : e . target . checked }
@@ -42,8 +47,9 @@ export default class App extends React.PureComponent<{}, IAppState> {
4247 < h1 className = { styles . title } > React Code Preview</ h1 >
4348 < CodePreview
4449 code = { code }
45- // style={{ maxHeight: 230 }}
4650 dependencies = { { Button } }
51+ bordered = { this . state . bordered }
52+ noScroll = { this . state . noScroll }
4753 bgWhite = { this . state . bgWhite }
4854 noCode = { this . state . noCode }
4955 noPreview = { this . state . noPreview }
@@ -57,25 +63,43 @@ export default class App extends React.PureComponent<{}, IAppState> {
5763 checked = { this . state . bgWhite }
5864 onChange = { this . handleChange . bind ( this , 'bgWhite' ) }
5965 >
60- 背景 `bgWhite`
66+ 背景 `bgWhite= { this . state . bgWhite . toString ( ) } `
6167 </ Switch >
62- < Divider type = "vertical" />
68+ < br />
6369 < Switch
6470 data-checked = "显示"
6571 data-unchecked = "隐藏"
6672 checked = { this . state . noCode }
6773 onChange = { this . handleChange . bind ( this , 'noCode' ) }
6874 >
69- 是否显示代码 `noCode`
75+ 是否显示代码 `noCode= { this . state . noCode . toString ( ) } `
7076 </ Switch >
71- < Divider type = "vertical" />
77+ < br />
7278 < Switch
7379 data-checked = "显示"
7480 data-unchecked = "隐藏"
7581 checked = { this . state . noPreview }
7682 onChange = { this . handleChange . bind ( this , 'noPreview' ) }
7783 >
78- 是否显示实例预览 `noPreview`
84+ 是否显示实例预览 `noPreview={ this . state . noPreview . toString ( ) } `
85+ </ Switch >
86+ < br />
87+ < Switch
88+ data-checked = "显示"
89+ data-unchecked = "隐藏"
90+ checked = { this . state . noScroll }
91+ onChange = { this . handleChange . bind ( this , 'noScroll' ) }
92+ >
93+ 是否显示滚动条 `noScroll={ this . state . noScroll . toString ( ) } `
94+ </ Switch >
95+ < br />
96+ < Switch
97+ data-checked = "显示"
98+ data-unchecked = "隐藏"
99+ checked = { this . state . bordered }
100+ onChange = { this . handleChange . bind ( this , 'bordered' ) }
101+ >
102+ 是否显示边框 `bordered={ this . state . bordered . toString ( ) } `
79103 </ Switch >
80104 </ div >
81105 < Markdown source = { DocumentStrSource } />
0 commit comments