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

[ui] Add system setting option for themes #18655

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Conversation

hellendag
Copy link
Member

@hellendag hellendag commented Dec 11, 2023

Summary & Motivation

Allow using the system setting for light/dark mode. This is added as a "System setting" option in the theme selector.

Also add a product tour component to direct users to the feature. Track its dismissed state in localStorage.

Screenshot 2023-12-11 at 4 39 22 PM

How I Tested These Changes

Remove dagster-theme from localStorage, view app. Verify that the tour popover appears, and that it can be dismissed (with state tracked) by clicking "Dismiss".

Choose "System setting" from theme selector in User Settings dialog, click "Done". Verify that I see dark mode on reload, with "System" as the value in localStorage.

@hellendag
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link

github-actions bot commented Dec 11, 2023

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-ase3yu490-elementl.vercel.app
https://dish-theme-system-pref.components-storybook.dagster-docs.io

Built with commit 952b75b.
This pull request is being automatically deployed with vercel-action

Copy link

github-actions bot commented Dec 11, 2023

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-eyogm7jun-elementl.vercel.app
https://dish-theme-system-pref.core-storybook.dagster-docs.io

Built with commit 952b75b.
This pull request is being automatically deployed with vercel-action

@salazarm
Copy link
Contributor

The little triangle in the top right is white

@hellendag
Copy link
Member Author

It sure is, good catch! Probably a mixup in the change to themes. Will fix.

@braunjj
Copy link
Contributor

braunjj commented Dec 12, 2023

Love it. Is there anyway to force a refresh? It's slightly annoying that I have to manually do a browser refresh for the theme change to take effect.

Copy link
Collaborator

@bengotow bengotow left a comment

Choose a reason for hiding this comment

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

Looks great! Will switch to using this after it merges :-)

modifiers={{offset: {enabled: true, options: {offset: [-12, 8]}}}}
>
{button}
</ProductTour>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wow I think I'd missed this in other PRs, this is a really nice component interface 💯

// return DagsterTheme.Dark;
// }
if (value === DagsterTheme.System) {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks good to me! I like that the memoize means this is only re-computed on page load so systems that change at dusk won't start returning dark as individual components on the page re-render.

@hellendag hellendag force-pushed the dish/theme-system-pref branch from cdd56c5 to 952b75b Compare December 12, 2023 16:01
@hellendag
Copy link
Member Author

Fixed the tour arrow.

Screenshot 2023-12-12 at 9 47 25 AM Screenshot 2023-12-12 at 9 47 07 AM

@hellendag
Copy link
Member Author

Love it. Is there anyway to force a refresh? It's slightly annoying that I have to manually do a browser refresh for the theme change to take effect.

Yeah, I have something in mind for this.

@hellendag hellendag merged commit 1b17067 into master Dec 12, 2023
3 checks passed
@hellendag hellendag deleted the dish/theme-system-pref branch December 12, 2023 16:37
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.

4 participants