This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.modal { | |
position: fixed; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
z-index: 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let documentBody = document.body; | |
let Modal = undefined; | |
function createElement(name, classes, parent) { | |
let element = document.createElement(name); | |
element.className += classes; | |
if (parent) { | |
parent.appendChild(element); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
padding: 0; | |
margin: 0; | |
box-sizing: border-box; | |
} | |
:root { | |
--background-color: #fff; | |
--text-color: #000; | |
--grey: #777; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the button that is used to toggle the dark mode | |
const themeBtn = document.getElementById("dark-mode-btn"); | |
// Get the <html> element | |
const docEl = document.documentElement; | |
// Handling the click event | |
themeBtn.addEventListener("click", () => { | |
// Toggle the dark-theme class inside of the html element | |
docEl.classList.toggle("dark-theme"); | |
// Set the dark theme value in user's browser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
padding: 0; | |
margin: 0; | |
box-sizing: border-box; | |
} | |
html { | |
background-color: #fff; | |
color: #000; | |
font-family: sans-serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the <link> element | |
const stylesheet = document.getElementById("main-style"); | |
// Get the button that is used to toggle the dark mode | |
const themeBtn = document.getElementById("dark-mode-btn"); | |
// Just an object literal that holds the file paths | |
const cssPath = { | |
light: "src/style.css", | |
dark: "src/style.dark.css", | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
padding: 0; | |
margin: 0; | |
box-sizing: border-box; | |
html { | |
background-color: #000; | |
color: #fff; | |
font-family: sans-serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
padding: 0; | |
margin: 0; | |
box-sizing: border-box; | |
} | |
html { | |
background-color: #fff; | |
color: #000; | |
font-family: sans-serif; |