mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
refactor(theme-classic): replace color mode toggle with button; remove switchConfig (#6771)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
b1492135c2
commit
7ec44bb32c
15 changed files with 282 additions and 356 deletions
|
@ -284,18 +284,6 @@ module.exports = {
|
|||
defaultMode: 'light',
|
||||
disableSwitch: false,
|
||||
respectPrefersColorScheme: true,
|
||||
switchConfig: {
|
||||
darkIcon: '🌙',
|
||||
lightIcon: '\u2600',
|
||||
// React inline style object
|
||||
// see https://reactjs.org/docs/dom-elements.html#style
|
||||
darkIconStyle: {
|
||||
marginLeft: '2px',
|
||||
},
|
||||
lightIconStyle: {
|
||||
marginLeft: '1px',
|
||||
},
|
||||
},
|
||||
},
|
||||
navbar: {
|
||||
title: 'Site Title',
|
||||
|
|
|
@ -28,11 +28,6 @@ Accepted fields:
|
|||
| `defaultMode` | <code>'light' \| 'dark'</code> | `'light'` | The color mode when user first visits the site. |
|
||||
| `disableSwitch` | `boolean` | `false` | Hides the switch in the navbar. Useful if you want to support a single color mode. |
|
||||
| `respectPrefersColorScheme` | `boolean` | `false` | Whether to use the `prefers-color-scheme` media-query, using user system preferences, instead of the hardcoded `defaultMode`. |
|
||||
| `switchConfig` | _See below_ | _See below_ | Dark/light switch icon options. |
|
||||
| `switchConfig.darkIcon` | `string` | `'🌜'` | Icon for the switch while in dark mode. |
|
||||
| `switchConfig.darkIconStyle` | JSX style object (see [documentation](https://reactjs.org/docs/dom-elements.html#style)) | `{}` | CSS to apply to dark icon. |
|
||||
| `switchConfig.lightIcon` | `string` | `'🌞'` | Icon for the switch while in light mode. |
|
||||
| `switchConfig.lightIconStyle` | JSX style object | `{}` | CSS to apply to light icon. |
|
||||
|
||||
</APITable>
|
||||
|
||||
|
@ -46,18 +41,6 @@ module.exports = {
|
|||
defaultMode: 'light',
|
||||
disableSwitch: false,
|
||||
respectPrefersColorScheme: false,
|
||||
switchConfig: {
|
||||
darkIcon: '🌙',
|
||||
darkIconStyle: {
|
||||
marginLeft: '2px',
|
||||
},
|
||||
// Unicode icons such as '\u2600' will work
|
||||
// Unicode with 5 chars require brackets: '\u{1F602}'
|
||||
lightIcon: '\u{1F602}',
|
||||
lightIconStyle: {
|
||||
marginLeft: '1px',
|
||||
},
|
||||
},
|
||||
},
|
||||
// highlight-end
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue