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

feat(root): adds dark mode switch #1222

Merged
merged 3 commits into from
Dec 5, 2024

Conversation

ad9242
Copy link
Contributor

@ad9242 ad9242 commented Nov 26, 2024

Summary of the changes

  • Adds dark mode switch to site.
  • Added system color preference. When a user first visits the page the initial theme will be whatever their system preference is
  • Added theme persistance through sessionStorage. If a user wants to adjust the system preference, they press the button and their preference is stored in sessionStorage where it will be used as the user's preferred theme if they refresh the page.
  • Added dark mode colors to guidance site specific elements. Tried to base them off the colors of the other components, however please comment if some don't seem correct :) Implement dark mode on the guidance site #1133

Related issue

#1216

Checklist

Copy link

@GCHQ-Developer-741 GCHQ-Developer-741 marked this pull request as draft November 27, 2024 11:09
@GCHQ-Developer-741 GCHQ-Developer-741 marked this pull request as ready for review November 28, 2024 11:33
@GCHQ-Developer-741 GCHQ-Developer-741 force-pushed the dark-mode-toggle branch 2 times, most recently from dfa0765 to ef0bfa8 Compare November 28, 2024 12:36
@ad9242
Copy link
Contributor Author

ad9242 commented Nov 28, 2024

Suggestion to use local storage or a cookie rather than session storage. If you open a page in a new window, it reverts back to your OS setting

@gd2910
Copy link
Contributor

gd2910 commented Dec 2, 2024

At 90% page zoom, when hovering the button, I get a horizontal scroll appear. Only when going to light mode though. Small issue but overflow-x: hidden on the fixes it if it is seen as an issue.

Copy link
Contributor

@GCHQ-Developer-530 GCHQ-Developer-530 left a comment

Choose a reason for hiding this comment

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

Found a couple of issues. The first time I open the site with dark mode as my system setting, it seems to know I'm in dark mode but doesn't update the site:
Cookie banner
Screenshot 2024-12-03 at 08 54 59

Site
Screenshot 2024-12-03 at 08 55 12

After I click the dark mode enabler button to light mode then dark mode again it's fixed itself and displays dark mode.
When in dark mode, the bottom image on the homepage means that some of the text isn't readable, a new image might need generating for dark mode that has darker boxes.

Screenshot 2024-12-03 at 08 54 25

adds dark mode switch to site
… & dark colors to guidance site

added dark mode colors to guidance site elements not already included,
added theme preferences to sessionStorage so choice persists, and theme
now defaults to the system preference
renamed classname to wrapper as it was passing down styles to light-dom components with the same
classname
@GCHQ-Developer-299 GCHQ-Developer-299 merged commit 4348d0c into v3.0.0/develop Dec 5, 2024
2 checks passed
@GCHQ-Developer-299 GCHQ-Developer-299 deleted the dark-mode-toggle branch December 5, 2024 08:55
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.

6 participants