Skip to content

Feature docs color #1796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions packages/taro-ui-docs/app.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import { HashRouter as Router, Switch, Route } from 'react-router-dom'
import { HashRouter as Router, Route, Switch } from 'react-router-dom'

import 'at-ui-style'

Expand All @@ -13,14 +13,14 @@ class App extends React.Component {
super(...args)
this.state = {
visible: false,
mode: 'light',
mode: 'light'
}
}
componentDidMount() {
const _mode = localStorage.getItem('mode')
this.setState({
visible: true,
mode: _mode || 'light',
mode: _mode || 'light'
})
}

Expand All @@ -31,29 +31,40 @@ class App extends React.Component {
handleMode() {
const _mode = this.state.mode
const modeVal = _mode === 'light' ? 'dark' : 'light'
this.setState({
mode: modeVal
}, () => {
localStorage.setItem('mode', modeVal)
})
this.setState(
{
mode: modeVal
},
() => {
localStorage.setItem('mode', modeVal)
}
)
}

render() {
const { mode } = this.state

return (
<div className='wrapper' style={{ backgroundColor: mode === 'light' ? '#F8FAFF' : '#434242' }}>
<div
className='wrapper'
style={{ backgroundColor: mode === 'light' ? '#F8FAFF' : '#434242' }}
>
<Switch>
<Route path='/' exact component={Index} />
<Route path='/docs' render={() => <Docs handleMode={this.handleMode.bind(this)} />} />
<Route
path='/docs'
render={props => (
<Docs {...props} handleMode={this.handleMode.bind(this)} />
)}
/>
<Route path='/guide' component={Guide} />
</Switch>
</div>
)
}
}
const container = document.getElementById('container');
const root = createRoot(container);
const container = document.getElementById('container')
const root = createRoot(container)
root.render(
<Router>
<App />
Expand Down
3 changes: 3 additions & 0 deletions packages/taro-ui-docs/assets/style/docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ $drop-shadow: 0 4px 30px 0 rgba(223, 225, 230, 0.5);

.darkbox {
background-color: #23272f;
&.at-container {
box-shadow: none;
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-ui-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
"copy-to-clipboard": "^3.3.1",
"highlight.js": "^10.7.2",
"qrcode.react": "^1.0.0",
"react-router-dom": "^5.1.2",
"react-router-dom": "^5.3.4",
"regenerator-runtime": "^0.13.5",
"taro-ui-demo": "workspace:^"
},
"devDependencies": {
"@types/classnames": "^2.2.10",
"@types/react-router-dom": "5.1.5",
"@types/webpack-env": "^1.15.1",
"babel-loader": "^8.1.0",
"chalk": "^4.0.0",
Expand Down
Loading
Loading