-
Notifications
You must be signed in to change notification settings - Fork 8
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
Label info link + update Tooltip theme setting #242
Conversation
Preview is available here: |
Preview is available here: |
callback={(isOpen) => { | ||
if (isOpen) { | ||
const theme = document.body.getAttribute("data-sds-theme"); | ||
|
||
if (theme) { | ||
setTheme(theme); | ||
} | ||
} | ||
}} |
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.
Using a callback is more accurate than using a listener.
@@ -60,22 +60,14 @@ export const ThemeSwitch = ({ | |||
if (isDarkMode) { | |||
document.body.classList.remove(ThemeMode.LIGHT); | |||
document.body.classList.add(ThemeMode.DARK); | |||
document.body.setAttribute("data-sds-theme", ThemeMode.DARK); |
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.
Other components can check for this attribute to get the current theme.
Info text (in tooltip)
Info link (opens in new window)