mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 22:17:00 +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
|
@ -21,12 +21,6 @@ const DEFAULT_COLOR_MODE_CONFIG = {
|
|||
defaultMode: 'light',
|
||||
disableSwitch: false,
|
||||
respectPrefersColorScheme: false,
|
||||
switchConfig: {
|
||||
darkIcon: '🌜',
|
||||
darkIconStyle: {},
|
||||
lightIcon: '🌞',
|
||||
lightIconStyle: {},
|
||||
},
|
||||
};
|
||||
|
||||
export const DEFAULT_CONFIG = {
|
||||
|
@ -220,20 +214,10 @@ const ColorModeSchema = Joi.object({
|
|||
respectPrefersColorScheme: Joi.bool().default(
|
||||
DEFAULT_COLOR_MODE_CONFIG.respectPrefersColorScheme,
|
||||
),
|
||||
switchConfig: Joi.object({
|
||||
darkIcon: Joi.string().default(
|
||||
DEFAULT_COLOR_MODE_CONFIG.switchConfig.darkIcon,
|
||||
),
|
||||
darkIconStyle: Joi.object().default(
|
||||
DEFAULT_COLOR_MODE_CONFIG.switchConfig.darkIconStyle,
|
||||
),
|
||||
lightIcon: Joi.string().default(
|
||||
DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIcon,
|
||||
),
|
||||
lightIconStyle: Joi.object().default(
|
||||
DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIconStyle,
|
||||
),
|
||||
}).default(DEFAULT_COLOR_MODE_CONFIG.switchConfig),
|
||||
switchConfig: Joi.any().forbidden().messages({
|
||||
'any.unknown':
|
||||
'colorMode.switchConfig is deprecated. If you want to customize the icons for light and dark mode, swizzle IconLightMode, IconDarkMode, or ColorModeToggle instead.',
|
||||
}),
|
||||
}).default(DEFAULT_COLOR_MODE_CONFIG);
|
||||
|
||||
// schema can probably be improved
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue