黑色主题适配

This commit is contained in:
rickcole 2020-07-29 20:25:04 +08:00
parent 547a22840c
commit 06c603bbc6
4 changed files with 99 additions and 16 deletions

View File

@ -93,6 +93,10 @@ export class App extends React.PureComponent {
document.querySelector( document.querySelector(
`link[title=${this.state.theme.value}]` `link[title=${this.state.theme.value}]`
).disabled = false; ).disabled = false;
if (this.state.theme.value === 'dark') {
document.querySelector('body').classList.add('dark');
}
} }
document.addEventListener('scroll', this.handleScroll.bind(this)); document.addEventListener('scroll', this.handleScroll.bind(this));
} }
@ -249,6 +253,9 @@ export class App extends React.PureComponent {
'themeIndex', 'themeIndex',
this.state.themes.indexOf(theme) this.state.themes.indexOf(theme)
); );
document
.querySelector('body')
.classList[theme.value === 'dark' ? 'add' : 'remove']('dark');
}} }}
/> />
</div> </div>

View File

@ -511,15 +511,14 @@ export const examples = [
icon: 'fa fa-cloud', icon: 'fa fa-cloud',
path: '/examples/iframe', path: '/examples/iframe',
component: makeSchemaRenderer(IFrameSchema) component: makeSchemaRenderer(IFrameSchema)
} },
// 放到使用中 {
// { label: 'SDK',
// label: 'SDK', icon: 'fa fa-rocket',
// icon: 'fa fa-rocket', path: '/examples/sdk',
// path: '/examples/sdk', component: SdkTest
// component: SdkTest }
// }
// { // {
// label: 'Test', // label: 'Test',

View File

@ -76,7 +76,7 @@ export default class SdkTest extends React.Component {
render() { render() {
return ( return (
<div> <div className="schema-wrapper">
<TitleBar title="API 调用 集成在你的 React 应用中" /> <TitleBar title="API 调用 集成在你的 React 应用中" />
<div className="wrapper"> <div className="wrapper">
{this.renderForm()} {this.renderForm()}

View File

@ -4,6 +4,9 @@
body { body {
background-color: #fff; background-color: #fff;
&.dark {
background-color: #333538;
}
} }
.page-play, .page-play,
@ -100,10 +103,6 @@ body {
.dark-Layout { .dark-Layout {
padding-top: 100px; padding-top: 100px;
&::before {
background-color: #fff;
}
&-header { &-header {
height: 64px; height: 64px;
box-shadow: none; box-shadow: none;
@ -115,7 +114,6 @@ body {
z-index: -1; z-index: -1;
left: 0; left: 0;
right: 0; right: 0;
background: #fff;
box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.1);
} }
} }
@ -143,7 +141,6 @@ body {
.a-Layout-brand, .a-Layout-brand,
.cxd-Layout-brand, .cxd-Layout-brand,
.dark-Layout-brand { .dark-Layout-brand {
color: #333;
height: 64px; height: 64px;
line-height: 64px; line-height: 64px;
font-size: 24px; font-size: 24px;
@ -154,6 +151,11 @@ body {
color: #108cee; color: #108cee;
} }
} }
.a-Layout-brand,
.cxd-Layout-brand {
color: #333;
}
} }
&-headerBar { &-headerBar {
@ -164,7 +166,7 @@ body {
height: 64px; height: 64px;
line-height: 64px; line-height: 64px;
font-size: 14px; font-size: 14px;
padding-left: 30px; padding-left: 35px;
> a { > a {
display: inline-block; display: inline-block;
@ -202,6 +204,29 @@ body {
} }
} }
} }
.dark-Layout {
&-header::before {
background-color: #191c22;
}
.Doc-search .dark-TextControl-input {
background-color: #191c22;
}
&-headerBar-links > a {
color: #eee;
}
}
.a-Layout,
.cxd-Layout {
&::before {
background-color: #fff;
}
&-header::before {
background: #fff;
}
}
} }
.Doc { .Doc {
@ -461,6 +486,58 @@ body {
} }
} }
.dark-Layout .Doc {
.Doc-headingList-item a {
color: #fff;
&:hover {
color: #999;
}
}
.Doc-navigation-item {
> a {
color: #ccc;
&:hover {
color: #fff;
}
}
&.is-top > a {
color: #eee;
&:hover {
color: #fff;
}
}
&.is-active > a,
&.is-active.is-top > a {
color: #108cee;
}
}
&-footer {
.Doc-navLinks--prev,
.Doc-navLinks--next {
color: #eee;
}
.Doc-navLinks-title {
color: #fff;
}
}
.Backtop {
color: #eee;
&:hover {
color: #108cee;
}
}
.markdown-body pre {
background-color: #282c34;
}
}
.Backtop { .Backtop {
position: fixed; position: fixed;
right: 40px; right: 40px;