Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| const { window, ...contextWithoutWindow } = useContext(ThemeContext); | ||
|
|
||
| return contextWithoutWindow; | ||
| return contextWithoutWindow as ThemeContextValue; |
There was a problem hiding this comment.
setMode should always be available from useTheme.
| window: targetWindow, | ||
| themeNext: Boolean(themeNext), | ||
| UNSTABLE_corner: corner, | ||
| setMode, |
There was a problem hiding this comment.
I don't think we need to include this in the dep array as React guarantees stable refs for useState setters
dc4f795 to
7b415b1
Compare
|
Storybook Preview Link https://1623b85b.saltdesignsystem-storybook.pages.dev |
| const mode = modeProp ?? inheritedMode; | ||
| const breakpoints = breakpointsProp ?? DEFAULT_BREAKPOINTS; | ||
| const corner = cornerProp ?? inheritedCorner ?? DEFAULT_CORNER; | ||
| const [mode, setMode] = useState<Mode>(modeProp ?? inheritedMode); |
There was a problem hiding this comment.
Should this be made using useControlled....?
There was a problem hiding this comment.
sure I can switch to that
7b415b1 to
ab0e3a3
Compare
ab0e3a3 to
f4fe967
Compare
Provide user's with the ability to update the theme mode.
The
SaltProviderkeeps the thememodein state and injectssetModeinto the theme context value.This allows the mode to be changed via a setter pulled from
useTheme()Marked as POC as I am a bit unsure about the TS types. Have a look at those please.