-
Notifications
You must be signed in to change notification settings - Fork 7
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
Enable switch between light and dark mode with button #660
Conversation
src/Client/Index.fs
Outdated
|
||
React.useEffectOnce (fun () -> | ||
themeChange false // Reattach event listeners manually | ||
let storedTheme = Browser.WebStorage.localStorage.getItem("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.
] | ||
] | ||
|
||
let currentTheme, setTheme = React.useState(document.documentElement.getAttribute("data-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.
please check if all this is still required. You might have to look into "data-theme" source code for this
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.
We could use a toggle button, that would be an easy implementation.
@@ -104,6 +104,10 @@ type React = | |||
) | |||
cancel, debouncedCallBack | |||
|
|||
static member inline useLocalStorage<'A>(func: (string * 'A) -> ('A * ('A -> unit)), key: string, defaultValue: 'A) = | |||
let useLocalStorage: (string * 'A) -> ('A * ('A -> unit)) = func |
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.
maybe put the import here? 😅
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.
Fable that you must not do that.
error FABLE: importMember must be assigned to a variable
Closes Issue #658