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

Different theme slider #521

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,30 @@
<meta name="description" content="Page not found on the Random Disco Light Simulator site. Please check the URL or return to the homepage.">
<link rel="icon" href="assets/images/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/404.css">
<link rel="stylesheet" href="./css/style.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<title>Error - 404</title>
<script src="./js/404.js" defer></script>
</head>

<body>
<div class="errorpage"></div>
<div class="stars"></div>
<div class="container">
<div class="text1">Oops!</div>
<div class="text2">404 - Page not Found</div>
<div class="text3">The page you are looking for might have been removed, had its name changed, or is temporarily
unavailable.</div>
<div class="text4 text3">Redirecting in <strong></strong> seconds</div>
<div class="text5"><a href="index.html">Go to HomePage</a></div>
<div class="dark-mode-toggle">
<input type="checkbox" id="dark-mode-toggle">
<label for="dark-mode-toggle">Dark Mode</label>
<div class="text4 text3">Redirecting in <strong></strong> seconds</div>
<div class="text5"><a href="index.html">Go to HomePage</a></div>
</div>
</div>
<div id="sun-moon-mode-toggler" class="toggle-container" >
<input type="checkbox" id="themeToggle" class="switch-checkbox">
<label id="themeChangeToggle" class="theme-switch" for="themeToggle">
<div class="toggle-button">
<span class="light-mode-icon"><img src="sun.svg" style = "display: block;"></span>
<span class="dark-mode-icon"><img src="moon.svg"style = "display: block;"></span>
</div>
</body>

</html>
32 changes: 1 addition & 31 deletions css/404.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ a {
border-radius: 50px;
transition: background-color 0.3s ease;
animation: slideUp 2s ease-in-out;
font-size: 16px;
}

a:hover {
Expand Down Expand Up @@ -192,37 +193,6 @@ a:hover {
}
}

/* Dark Mode Toggle */

.dark-mode-toggle {
position: fixed;
top: 20px;
right: 20px;
z-index: 100;
display: flex;
align-items: center;
justify-content: flex-end;
color: white;
}

.dark-mode-toggle label {
margin-left: 5px;
cursor: pointer;
}

.dark-mode-toggle input[type="checkbox"] {
display: none;
}

.dark-mode-toggle input[type="checkbox"] + label:before {
content: '\1F31E'; /* Sun emoji for light mode */
font-size: 20px;
}

.dark-mode-toggle input[type="checkbox"]:checked + label:before {
content: '\1F30C'; /* Moon emoji for dark mode */
}

body.dark-mode {
background: #333; /* Dark background color */
color: white;
Expand Down
120 changes: 57 additions & 63 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,15 @@ nav ul li a:hover {
text-align: center;
}

/* Styles for the the theme toggle checkbox */

.theme-toggle {
/* Styled for the theme toggle */
.toggle-container {
transform: translate(-50%, -50%);
display: flex;
align-items: center;
justify-content: center;
margin: 30px 0 0 30px;
right: -4px;
top: 15px;
position: fixed;
top: 30px;
right: 20px;
Expand All @@ -955,88 +961,76 @@ nav ul li a:hover {
margin: 0 5px;
}

.theme-toggle input {
opacity: 0;
width: 0;
height: 0;
/* Hidden Checkbox */
.switch-checkbox {
display: none;
}

.slider {
.theme-switch {
position: relative;
width: 45px;
height: 30px;
background-color: #ccc;
border-radius: 20px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0.85;
background-color: #000000;
border-radius: 34px;
transition: background-color 0.4s;
box-shadow: 0 0 3px #ffffff;
}

@media screen and (max-width: 425px) {
.slider {
cursor: pointer;
position: absolute;
top: -15px;
left: 0;
right: 0;
bottom: 0;
opacity: 0.85;
background-color: #000000;
border-radius: 34px;
transition: background-color 0.4s;
box-shadow: 0 0 3px #ffffff;
}

.input {
width: 15px;
}
display: flex;
align-items: center;
justify-content: center;
padding: 0 5px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: background-color 0.5s ease;
}

.slider:hover {
opacity: 1;
.theme-switch .light-mode-icon,
.theme-switch .dark-mode-icon {
font-size: 19px;
position: absolute;
cursor: pointer;
top: 50%;
transform: translateY(-50%);
transition: opacity 0.5s ease, color 0.5s ease;
}

.light-mode .slider {
background-color: #ffffff;
box-shadow: 0 0 5px #020202;
.theme-switch .light-mode-icon {
color: #f39c12;
}

.light-mode .slider:before {
height: 16px;
width: 16px;
left: 2px;
bottom: 2px;
background-image: linear-gradient(to bottom right, yellow, orange, red);
box-shadow: none;
.theme-switch .dark-mode-icon {
color: #bdc3c7;
opacity: 0;
}

.slider:before {
.toggle-button {
position: absolute;
content: "";
height: 14px;
width: 14px;
top: 3px;
left: 3px;
bottom: 3px;
/* background-image: linear-gradient(to bottom right, yellow, orange, red); */
background-image: linear-gradient(black, rgb(18, 18, 18));
box-shadow: inset -3px -1.4px #ffffff, inset -3.2px -1.4px 0.2px 0.1px rgb(58, 52, 58);
width: 25px;
height: 25px;
background-color: #fff;
border-radius: 50%;
transition: transform 0.4s;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
transition: transform 0.5s ease, background-color 0.5s ease;
}

.dark-mode .slider:before {
transition: transform 0.4s;
/* Checkbox Checked State */
.switch-checkbox:checked + .theme-switch {
background-color: #34495e;
}

input:checked+.slider:before {
transform: translateX(20px);
.switch-checkbox:checked + .theme-switch .light-mode-icon {
opacity: 0;
}

.switch-checkbox:checked + .theme-switch .dark-mode-icon {
opacity: 1;
}

.switch-checkbox:checked + .theme-switch .toggle-button {
transform: translateX(13px);
/* background-color: #34495e; */
}

/* sidebar social icons panel */
.socialIcons {

position: fixed;
Expand Down
108 changes: 2 additions & 106 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -416,18 +416,8 @@ <h1 id="changingHeading">Random Disco <span id="changing">Light Simulator</span>

<!-- <div id="message" aria-live="polite">The timer has ended. The page will reload.</div> -->

<!-- <label id="themeChangeToggle" class="theme-toggle" for="themeToggle" style="position: fixed;
top: 30px;
right: 30px;
z-index: 100;
display: flex;
align-items: center;
border: none;
background-color: transparent;">
<input type="checkbox" id="themeToggle" onclick="toggleTheme()" checked aria-label="Switch theme mode">
<span class="slider" style="width: 40px; height: 20px;"></span>
</label> -->
<span class="slider" style="width: 40px; height: 20px; display: none;"></span>

<span class="slider" style="width: 40px; height: 20px; display: none;"></span>

<div id="sun-moon-mode-toggler" class="toggle-container" >
<input type="checkbox" id="themeToggle" class="switch-checkbox" onclick="toggleTheme()">
Expand All @@ -439,100 +429,6 @@ <h1 id="changingHeading">Random Disco <span id="changing">Light Simulator</span>
</label>
</div>

<style>
.toggle-container {
transform: translate(-50%, -50%);
display: flex;
align-items: center;
justify-content: center;
margin: 30px 0 0 30px;
right: -4px;
top: 15px;
position: fixed;
top: 30px;
right: 20px;
z-index: 100;
display: flex;
align-items: center;
border: none;
background-color: transparent;
width: 40px;
height: 20px;
margin: 0 5px;
}


/* Hidden Checkbox */
.switch-checkbox {
display: none;
}

.theme-switch {
position: relative;
width: 45px;
height: 30px;
background-color: #ccc;
border-radius: 20px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
padding: 0 5px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: background-color 0.5s ease;
}

.theme-switch .light-mode-icon,
.theme-switch .dark-mode-icon {
font-size: 19px;
position: absolute;
cursor: pointer;
top: 50%;
transform: translateY(-50%);
transition: opacity 0.5s ease, color 0.5s ease;
}

.theme-switch .light-mode-icon {
color: #f39c12;
}

.theme-switch .dark-mode-icon {
color: #bdc3c7;
opacity: 0;
}

.toggle-button {
position: absolute;
top: 3px;
left: 3px;
width: 25px;
height: 25px;
background-color: #fff;
border-radius: 50%;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
transition: transform 0.5s ease, background-color 0.5s ease;
}

/* Checkbox Checked State */
.switch-checkbox:checked + .theme-switch {
background-color: #34495e;
}

.switch-checkbox:checked + .theme-switch .light-mode-icon {
opacity: 0;
}

.switch-checkbox:checked + .theme-switch .dark-mode-icon {
opacity: 1;
}

.switch-checkbox:checked + .theme-switch .toggle-button {
transform: translateX(13px);
/* background-color: #34495e; */
}

</style>


<!-- Modal background -->
<!-- <div id="modalBackground" style="color: #fff;">
Expand Down
2 changes: 1 addition & 1 deletion js/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', function () {
starsContainer.appendChild(star);
}

const darkModeToggle = document.getElementById('dark-mode-toggle');
const darkModeToggle = document.getElementById('themeToggle');
darkModeToggle.addEventListener('change', function () {
document.body.classList.toggle('dark-mode');
});
Expand Down
Loading
Loading