11import React from 'react'
22import { createRoot } from 'react-dom/client'
3- import { HashRouter as Router , Switch , Route } from 'react-router-dom'
3+ import { HashRouter as Router , Route , Switch } from 'react-router-dom'
44
55import 'at-ui-style'
66
@@ -13,14 +13,14 @@ class App extends React.Component {
1313 super ( ...args )
1414 this . state = {
1515 visible : false ,
16- mode : 'light' ,
16+ mode : 'light'
1717 }
1818 }
1919 componentDidMount ( ) {
2020 const _mode = localStorage . getItem ( 'mode' )
2121 this . setState ( {
2222 visible : true ,
23- mode : _mode || 'light' ,
23+ mode : _mode || 'light'
2424 } )
2525 }
2626
@@ -31,29 +31,40 @@ class App extends React.Component {
3131 handleMode ( ) {
3232 const _mode = this . state . mode
3333 const modeVal = _mode === 'light' ? 'dark' : 'light'
34- this . setState ( {
35- mode : modeVal
36- } , ( ) => {
37- localStorage . setItem ( 'mode' , modeVal )
38- } )
34+ this . setState (
35+ {
36+ mode : modeVal
37+ } ,
38+ ( ) => {
39+ localStorage . setItem ( 'mode' , modeVal )
40+ }
41+ )
3942 }
4043
4144 render ( ) {
4245 const { mode } = this . state
4346
4447 return (
45- < div className = 'wrapper' style = { { backgroundColor : mode === 'light' ? '#F8FAFF' : '#434242' } } >
48+ < div
49+ className = 'wrapper'
50+ style = { { backgroundColor : mode === 'light' ? '#F8FAFF' : '#434242' } }
51+ >
4652 < Switch >
4753 < Route path = '/' exact component = { Index } />
48- < Route path = '/docs' render = { ( ) => < Docs handleMode = { this . handleMode . bind ( this ) } /> } />
54+ < Route
55+ path = '/docs'
56+ render = { props => (
57+ < Docs { ...props } handleMode = { this . handleMode . bind ( this ) } />
58+ ) }
59+ />
4960 < Route path = '/guide' component = { Guide } />
5061 </ Switch >
5162 </ div >
5263 )
5364 }
5465}
55- const container = document . getElementById ( 'container' ) ;
56- const root = createRoot ( container ) ;
66+ const container = document . getElementById ( 'container' )
67+ const root = createRoot ( container )
5768root . render (
5869 < Router >
5970 < App />
0 commit comments