Skip to content

Commit

Permalink
💄 Set the default mode to light
Browse files Browse the repository at this point in the history
💡 Update some JS comments
  • Loading branch information
CHALENCON-Yoan committed Aug 22, 2024
1 parent f728e41 commit ba59252
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
property="og:image"
content="https://ade-edt.fr/assets/logo/logoLight.png"
/>
<title>Site en construction.</title>
<title>Site en construction</title>
<link rel="shortcut icon" href="/assets/favicon.svg" type="image/x-icon" />
<link rel="stylesheet" href="/font.css" />
<link rel="stylesheet" href="/style.css" />
</head>
<body class="mode">
<body class="mode lightMode">
<header>
<a href="/" class="darkModeDisplay">
<img id="logoDarkMode" src="/assets/logo/logoLight.svg" alt="Logo Soon"
Expand All @@ -33,7 +33,7 @@
/></a>
<img
id="switchDarkLightMode"
src="/assets/switchDarkLightMode/darkMode.svg"
src="/assets/switchDarkLightMode/lightMode.svg"
alt="Switch Dark/Light Mode"
/>
</header>
Expand Down
8 changes: 4 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ function getOppositeMode(mode) {
}

function setMode(mode) {
// If mode is null, set it to dark
// If mode is null, set it to light (default value)
if (mode === null) {
mode = "dark";
mode = "light";
}

const oppositeMode = getOppositeMode(mode);

// Save the mode in local storage
localStorage.setItem("mode", mode);

// Set/Change the mode on gloabl elements
// Set/Change the mode on global elements
modeElements = document.querySelectorAll(".mode");
modeElements.forEach((element) => {
element.classList.remove(`${oppositeMode}Mode`);
Expand All @@ -44,7 +44,7 @@ function setMode(mode) {
element.style.display = "none";
});

// Set/Change the on mode switch button
// Set/Change the mode on mode switch button
switchModeButton = document.querySelector("#switchDarkLightMode");
switchModeButton.setAttribute(
"src",
Expand Down
3 changes: 1 addition & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
color: var(--color-dark);
}

.darkModeDisplay,
.lightModeDisplay {
.darkModeDisplay {
display: none;
}

Expand Down

0 comments on commit ba59252

Please sign in to comment.