-
Notifications
You must be signed in to change notification settings - Fork 745
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
Added dark mode toggle feature #609
base: main
Are you sure you want to change the base?
Conversation
body.classList.toggle("dark-mode"); | ||
|
||
// Save user preference | ||
const isDarkMode = body.classList.contains("dark-mode"); |
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.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
const body = document.body; | ||
|
||
// Check for saved user preference | ||
const darkModeEnabled = localStorage.getItem("dark-mode") === "true"; |
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.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
document.addEventListener("DOMContentLoaded", function () { | ||
const toggleButton = document.getElementById("toggle-button"); | ||
const toggleIcon = document.getElementById("toggle-icon"); | ||
const body = document.body; |
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.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
@@ -0,0 +1,23 @@ | |||
document.addEventListener("DOMContentLoaded", function () { | |||
const toggleButton = document.getElementById("toggle-button"); | |||
const toggleIcon = document.getElementById("toggle-icon"); |
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.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
@@ -0,0 +1,23 @@ | |||
document.addEventListener("DOMContentLoaded", function () { | |||
const toggleButton = document.getElementById("toggle-button"); |
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.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Title: Add Dark Mode Toggle Feature
Description:
Hey team! This pull request brings a sleek dark mode toggle to the Rails Girls Guides project. Now, users can easily switch between light and dark themes to suit their preferences.
Key Changes:
Header Update: Added a handy toggle button with sun and moon icons to switch between themes.
JavaScript Integration: Included a script to manage dark mode toggling, with preferences saved in localStorage.
CSS Styles: Crafted styles for dark mode, tweaking text and background colors for optimal readability.
Footer Update: Ensured dark mode consistency throughout the site, including the footer.
User Experience:
Easy Toggle: Users can switch themes via a button in the header, making it super accessible.
Persistent Preferences: The chosen theme is saved, so users keep their preference across sessions.