Skip to content

Commit

Permalink
Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
EuJinnLucaShow committed Nov 8, 2023
1 parent f3ca3ec commit 4b8282e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
17 changes: 9 additions & 8 deletions src/css/closkcss.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ body {
inset 0 15px 15px rgba(0, 0, 0, 0.3);
transition: all ease 0.2s;
position: fixed;
top: 1%;
left: 1%;
top: 10px;
left: 10px;
}
.clock:before {
content: "";
Expand Down Expand Up @@ -108,17 +108,18 @@ body {
border-radius: 2px;
}

/* Style for theme switch btn */
.switch-cont {
margin: 2em auto;
/* position: absolute; */
bottom: 0;

.switch-cont {
position: absolute;
top: 150px;
left: 40px;
}
.switch-cont .switch-btn {
font-family: monospace;
text-transform: uppercase;
outline: none;
padding: 0.5rem 1rem;
width: 70px;
padding: 8px 16px;
background-color: var(--main-bg-color);
color: var(--main-text-color);
border: 1px solid var(--main-text-color);
Expand Down
3 changes: 3 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<div class="min"></div>
<div class="sec"></div>
</div>
<div class="switch-cont">
<button class="switch-btn"> Light </button>
</div>
<h1 class="title"><span class="span-cats">Cats</span><span class="span-breeds">Breeds</span></h1>
<select id="breed-select"></select>
<div class="cat-info"></div>
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SlimSelect from 'slim-select';
import { fetchBreeds, fetchCatByBreed } from './js/cat-api.js';
import { fetchBreeds, fetchCatByBreed } from './js/api.js';
import iziToast from 'izitoast';
import 'izitoast/dist/css/iziToast.min.css';
import noImage from './image/no_image.png'
Expand Down
File renamed without changes.
12 changes: 5 additions & 7 deletions src/js/clock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Just noticed accessing localStorage is banned from codepen, so disabling saving theme to localStorage

const deg = 6;
const hour = document.querySelector(".hour");
const min = document.querySelector(".min");
Expand All @@ -25,11 +23,11 @@ const switchTheme = (evt) => {
const switchBtn = evt.target;
if (switchBtn.textContent.toLowerCase() === "light") {
switchBtn.textContent = "dark";
// localStorage.setItem("theme", "dark");
localStorage.setItem("theme", "dark");
document.documentElement.setAttribute("data-theme", "dark");
} else {
switchBtn.textContent = "light";
// localStorage.setItem("theme", "light"); //add this
localStorage.setItem("theme", "light"); //add this
document.documentElement.setAttribute("data-theme", "light");
}
};
Expand All @@ -38,9 +36,9 @@ const switchModeBtn = document.querySelector(".switch-btn");
switchModeBtn.addEventListener("click", switchTheme, false);

let currentTheme = "dark";
// currentTheme = localStorage.getItem("theme")
// ? localStorage.getItem("theme")
// : null;
currentTheme = localStorage.getItem("theme")
? localStorage.getItem("theme")
: null;

if (currentTheme) {
document.documentElement.setAttribute("data-theme", currentTheme);
Expand Down

0 comments on commit 4b8282e

Please sign in to comment.