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:
Joshua Chen 2022-03-02 22:57:17 +08:00 committed by GitHub
parent b1492135c2
commit 7ec44bb32c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 282 additions and 356 deletions

View file

@ -7,95 +7,117 @@
import type {SwizzleConfig} from '@docusaurus/types';
/* eslint sort-keys: "error" */
export default function getSwizzleConfig(): SwizzleConfig {
return {
components: {
CodeBlock: {
actions: {
wrap: 'safe',
eject: 'safe',
wrap: 'safe',
},
description:
'The component used to render multi-line code blocks, generally used in Markdown files.',
},
ColorModeToggle: {
actions: {
eject: 'safe',
wrap: 'safe',
},
description:
'The color mode toggle to switch between light and dark mode.',
},
DocSidebar: {
actions: {
wrap: 'safe',
eject: 'unsafe', // too much technical code in sidebar, not very safe atm
wrap: 'safe',
},
description: 'The sidebar component on docs pages',
},
Footer: {
actions: {
wrap: 'safe',
eject: 'unsafe', // TODO split footer into smaller parts
wrap: 'safe',
},
description: "The footer component of you site's layout",
},
IconArrow: {
actions: {
eject: 'safe',
wrap: 'safe',
},
description: 'The arrow icon component',
},
IconDarkMode: {
actions: {
eject: 'safe',
wrap: 'safe',
},
description: 'The dark mode icon component.',
},
IconEdit: {
actions: {
eject: 'safe',
wrap: 'safe',
},
description: 'The edit icon component',
},
IconLightMode: {
actions: {
eject: 'safe',
wrap: 'safe',
},
description: 'The light mode icon component.',
},
IconMenu: {
actions: {
eject: 'safe',
wrap: 'safe',
},
description: 'The menu icon component',
},
MDXComponents: {
actions: {
eject: 'safe',
wrap: 'forbidden', /// TODO allow wrapping objects???
},
description:
'The MDX components to use for rendering MDX files. Meant to be ejected.',
},
// TODO should probably not even appear here
'NavbarItem/utils': {
actions: {
eject: 'forbidden',
wrap: 'forbidden',
},
},
NotFound: {
actions: {
wrap: 'safe',
eject: 'safe',
wrap: 'safe',
},
description:
'The global 404 page of your site, meant to be ejected and customized',
},
SearchBar: {
actions: {
wrap: 'safe',
eject: 'safe',
wrap: 'safe',
},
// TODO how to describe this one properly?
// By default it's an empty placeholder for the user to fill
description:
'The search bar component of your site, appearing in the navbar.',
},
IconArrow: {
actions: {
wrap: 'safe',
eject: 'safe',
},
description: 'The arrow icon component',
},
IconEdit: {
actions: {
wrap: 'safe',
eject: 'safe',
},
description: 'The edit icon component',
},
IconMenu: {
actions: {
wrap: 'safe',
eject: 'safe',
},
description: 'The menu icon component',
},
'prism-include-languages': {
actions: {
wrap: 'forbidden', // not a component!
eject: 'safe',
wrap: 'forbidden', // not a component!
},
description:
'The Prism languages to include for code block syntax highlighting. Meant to be ejected.',
},
MDXComponents: {
actions: {
wrap: 'forbidden', /// TODO allow wrapping objects???
eject: 'safe',
},
description:
'The MDX components to use for rendering MDX files. Meant to be ejected.',
},
// TODO should probably not even appear here
'NavbarItem/utils': {
actions: {
wrap: 'forbidden',
eject: 'forbidden',
},
},
},
};
}