From bbe1eb7b4a15716835558c535b8068769a816b50 Mon Sep 17 00:00:00 2001 From: benjacanas Date: Wed, 19 Jan 2022 06:59:19 -0300 Subject: [PATCH] moon-sun theme toggle --- src/components/NavBar/NavBar.scss | 35 +++++----------------------- src/constants/MenuLinks/MenuLinks.js | 16 +++++-------- src/images/moon-solid.svg | 1 + src/images/sun-solid.svg | 1 + 4 files changed, 14 insertions(+), 39 deletions(-) create mode 100644 src/images/moon-solid.svg create mode 100644 src/images/sun-solid.svg diff --git a/src/components/NavBar/NavBar.scss b/src/components/NavBar/NavBar.scss index fac6ec85..e874b3f0 100644 --- a/src/components/NavBar/NavBar.scss +++ b/src/components/NavBar/NavBar.scss @@ -64,33 +64,10 @@ } -.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle-ball{ - transform: translateX(24px); -} - -.theme-toggle-checkbox{ - opacity:0; - position:absolute; -} - -.theme-toggle-label{ - cursor: pointer; - width:50px; - height:26px; - background: $secondary-container; - border-radius: 50px; - padding: 5px; - position:relative; -} - -.theme-toggle-ball{ - position:absolute; - top:2px; - left:2px; - width:22px; - height:22px; - background: $primary; - border-radius:50%; - - transition: transform 0.2s linear; +.theme-toggle{ + background: none; + border: none; + img { + margin: 0; + } } \ No newline at end of file diff --git a/src/constants/MenuLinks/MenuLinks.js b/src/constants/MenuLinks/MenuLinks.js index f2fec010..8812aca1 100644 --- a/src/constants/MenuLinks/MenuLinks.js +++ b/src/constants/MenuLinks/MenuLinks.js @@ -3,6 +3,9 @@ import { Link } from "gatsby" import Nav from "react-bootstrap/Nav" import { useTheme } from "../../context/themeContext" +import moon from '../../images/moon-solid.svg' +import sun from '../../images/sun-solid.svg' + const MENU_LINKS = [ { id: 1, text: "home", url: "/" }, { id: 2, text: "servicios", url: "/servicios" }, @@ -30,16 +33,9 @@ const MenuLinks = ({ styleClass }) => { ))} - - + ) diff --git a/src/images/moon-solid.svg b/src/images/moon-solid.svg new file mode 100644 index 00000000..e687fb82 --- /dev/null +++ b/src/images/moon-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/images/sun-solid.svg b/src/images/sun-solid.svg new file mode 100644 index 00000000..083ff2bc --- /dev/null +++ b/src/images/sun-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file