Skip to content

Commit

Permalink
fix switcher's move
Browse files Browse the repository at this point in the history
  • Loading branch information
PodvAx committed Sep 12, 2023
1 parent a04df1b commit 7d2f137
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
10 changes: 0 additions & 10 deletions src/scripts/light-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ function setThemeBasedOnUserPreference() {
page.classList.remove('page--theme--light');
contactUs.classList.remove('contact-us--theme--light');

switchers.forEach(switcher => {
switcher.classList.remove('page__theme-switcher--theme--light');
});

links.forEach(link => {
link.classList.remove('link--theme--light');
});
Expand Down Expand Up @@ -49,10 +45,6 @@ function setThemeBasedOnUserPreference() {
page.classList.add('page--theme--light');
contactUs.classList.add('contact-us--theme--light');

switchers.forEach(switcher => {
switcher.classList.add('page__theme-switcher--theme--light');
});

links.forEach(link => {
link.classList.add('link--theme--light');
});
Expand Down Expand Up @@ -85,7 +77,6 @@ switchers.forEach(switcher => {
switcher.addEventListener('click', () => {
if (page.classList.contains('page--theme--light')) {
page.classList.remove('page--theme--light');
switcher.classList.remove('page__theme-switcher--theme--light');
contactUs.classList.remove('contact-us--theme--light');

links.forEach(link => {
Expand Down Expand Up @@ -113,7 +104,6 @@ switchers.forEach(switcher => {
});
} else {
page.classList.add('page--theme--light');
switcher.classList.add('page__theme-switcher--theme--light');
contactUs.classList.add('contact-us--theme--light');

links.forEach(link => {
Expand Down
9 changes: 3 additions & 6 deletions src/styles/blocks/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
--page-bg: #f2f6fa;
--header-footer-bg: #2c2c2c;
--bg-icon: url("../images/icons/icon-moon.svg");
--move: translateX(0);

--header-border-rds: 0 0 30px 30px;
--footer-border-rds: 30px 30px 0 0;
Expand All @@ -22,6 +23,7 @@
--page-bg: #f2f9ff;
--header-footer-bg: #008aff;
--bg-icon: url("../images/icons/icon-sun.svg");
--move: translateX(100%);

--header-border-rds: 0 0 0 200px;
--footer-border-rds: 0 200px 0 0;
Expand Down Expand Up @@ -125,13 +127,8 @@
background-repeat: no-repeat;
border-radius: 100%;
padding-bottom: 50%;
transform: var(--move);
transition: 0.5s;
}

&--theme--light {
&::after {
transform: translateX(100%);
}
}
}
}

0 comments on commit 7d2f137

Please sign in to comment.