Skip to content
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

Merged
merged 7 commits into from
Apr 1, 2025

Conversation

Etschbeijer
Copy link
Collaborator

Closes Issue #658

@Etschbeijer Etschbeijer requested a review from Freymaurer March 25, 2025 11:04
@Etschbeijer Etschbeijer self-assigned this Mar 25, 2025

React.useEffectOnce (fun () ->
themeChange false // Reattach event listeners manually
let storedTheme = Browser.WebStorage.localStorage.getItem("theme")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be handled by theme-change ? Because it specifically give instructions on how you could use a custom localStoragekey:

image

]
]

let currentTheme, setTheme = React.useState(document.documentElement.getAttribute("data-theme"))
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

@Etschbeijer Etschbeijer marked this pull request as draft March 28, 2025 08:32
@Etschbeijer Etschbeijer requested a review from Freymaurer March 31, 2025 11:28
@Etschbeijer Etschbeijer marked this pull request as ready for review March 31, 2025 11:29
@@ -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
Copy link
Collaborator

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? 😅

Copy link
Collaborator Author

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

@Etschbeijer Etschbeijer changed the base branch from main to feature_table_rework April 1, 2025 10:41
@Freymaurer Freymaurer merged commit f3e808e into feature_table_rework Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants