1- import { useState } from 'react' ;
21import BackToUp from '@uiw/react-back-to-top' ;
32import GithubCorner from '@uiw/react-github-corners' ;
43import MarkdownPreview from '@uiw/react-markdown-preview' ;
54import '@wcj/dark-mode' ;
65import DocumentStr from '../README.md' ;
7- import MarkdownEditor from '../' ;
86import styles from './App.module.less' ;
97import Footer from './components/Footer' ;
108import { ReactComponent as Logo } from './logo.svg' ;
9+ import { Example } from './Example' ;
1110
1211const DocumentStrSource = DocumentStr . replace ( / ( [ \s \S ] * ) < ! - - d i v i d i n g - - > / , '' ) . replace ( / ^ \n * / g, '' ) ;
13- let count = 1 ;
1412
1513export default function App ( ) {
16- const [ visible , setVisible ] = useState ( true ) ;
17- const [ mdstr , setMdstr ] = useState < string > ( DocumentStrSource ) ;
18- const [ hideToolbar , setHideToolbar ] = useState ( true ) ;
1914 return (
2015 < div className = { styles . warpper } >
2116 < BackToUp > Top</ BackToUp >
@@ -24,25 +19,7 @@ export default function App() {
2419 < div className = { styles . logo } >
2520 < Logo style = { { fill : 'currentColor' } } />
2621 </ div >
27- < div className = { styles . editor } >
28- < MarkdownEditor visible = { visible } height = "500px" value = { mdstr } hideToolbar = { hideToolbar } />
29- < div style = { { marginTop : 10 , display : 'flex' , gap : '10px' } } >
30- < button
31- onClick = { ( ) => {
32- count += 1 ;
33- setMdstr ( `String ${ count } ` ) ;
34- } }
35- >
36- Modify Markdown
37- </ button >
38- < label >
39- < input type = "checkbox" checked = { hideToolbar } onChange = { ( evn ) => setHideToolbar ( evn . target . checked ) } />
40- hideToolbar
41- </ label >
42- < button onClick = { ( ) => setVisible ( ! visible ) } > { visible ? 'Show' : 'Hide' } </ button >
43- < span > v{ VERSION } </ span >
44- </ div >
45- </ div >
22+ < Example />
4623 < MarkdownPreview source = { DocumentStrSource } className = { styles . doc } />
4724 < Footer
4825 name = "Kenny Wong"
0 commit comments