-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
refactor(theme-classic): replace color mode toggle with button; remove switchConfig #6771
Conversation
✔️ [V2] 🔨 Explore the source changes: 2722084 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6219e3933270f90008336b70 😎 Browse the preview: https://deploy-preview-6771--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-6771--docusaurus-2.netlify.app/ |
const [checked, setChecked] = useState(defaultChecked); | ||
const [focused, setFocused] = useState(false); | ||
const inputRef = useRef<HTMLInputElement>(null); | ||
function Toggle({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review with hide white space
Size Change: +268 B (0%) Total Size: 789 kB
ℹ️ View Unchanged
|
This comment was marked as duplicate.
This comment was marked as duplicate.
That looks nice Was wondering what's your opinion on having some kind of SVG interpolation morphing one svg to another? https://web.dev/building-a-theme-switch-component/ Also like this one: https://www.joshwcomeau.com/ |
Seems cool. Would be a useful extension. Not sure how much that would hinder the user from swapping out icons though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
As this is a breaking change, I'm going to also rename this one to ColorModeToggle
@@ -7,94 +7,116 @@ | |||
|
|||
import type {SwizzleConfig} from '@docusaurus/types'; | |||
|
|||
/* eslint sort-keys: "error" */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Breaking change
Toggle
component is renamed toColorModeToggle
. Please update your swizzled components.colorMode.switchConfig
is deprecated. If you want to customize the icons for light and dark mode, swizzleIconLightMode
,IconDarkMode
, orColorModeToggle
instead.Motivation
Part of #6717
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Before
After