From 9bc3f1213ce6f56d95998434c40263aa712b395e Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Sat, 9 Mar 2024 18:51:41 +0100 Subject: [PATCH] Ya funciona correctamente --- webapp/src/App.css | 8 ++++ webapp/src/components/Nav/Nav.css | 69 +++---------------------------- webapp/src/components/Nav/Nav.js | 21 ++++------ webapp/src/index.js | 5 ++- 4 files changed, 26 insertions(+), 77 deletions(-) diff --git a/webapp/src/App.css b/webapp/src/App.css index e6ef8e78..a5ff5dde 100644 --- a/webapp/src/App.css +++ b/webapp/src/App.css @@ -14,6 +14,14 @@ --text: #0F0F0F; } +/* Estilos para el tema oscuro */ +#root[data-theme="light"] { + --shadow: rgba(0, 255, 192, 1); + --borders: #0F0F0F; + --background: #F0F0F0; + --text: #0F0F0F; +} + /* Estilos para el tema oscuro */ #root[data-theme="dark"] { --shadow: orange; diff --git a/webapp/src/components/Nav/Nav.css b/webapp/src/components/Nav/Nav.css index 40eca7d3..44cbe801 100644 --- a/webapp/src/components/Nav/Nav.css +++ b/webapp/src/components/Nav/Nav.css @@ -32,67 +32,8 @@ nav li { flex-direction: row; } -.slider-container { - display: flex; - align-items: center; - justify-content: center; - margin-top: 50px; - } - - .switch { - position: relative; - display: inline-block; - width: 60px; - height: 34px; - } - - .switch input { - opacity: 0; - width: 0; - height: 0; - } - - .slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: #ccc; - transition: 0.4s; - border-radius: 34px; - } - - .slider:before { - position: absolute; - content: ""; - height: 26px; - width: 26px; - left: 4px; - bottom: 4px; - background-color: white; - transition: 0.4s; - border-radius: 50%; - } - - input:checked + .slider { - background-color: #2196F3; - } - - input:focus + .slider { - box-shadow: 0 0 1px #2196F3; - } - - input:checked + .slider:before { - transform: translateX(26px); - } - - .slider.round { - border-radius: 34px; - } - - .slider.round:before { - border-radius: 50%; - } - \ No newline at end of file +.theme-toggle{ + width: 5%; + height: 10%; + margin-left: 90%; +} diff --git a/webapp/src/components/Nav/Nav.js b/webapp/src/components/Nav/Nav.js index d69ee850..9d0a3930 100644 --- a/webapp/src/components/Nav/Nav.js +++ b/webapp/src/components/Nav/Nav.js @@ -8,25 +8,22 @@ const Nav = () => { // FunciĆ³n para alternar entre temas claro y oscuro const toggleTheme = () => { - const root = document.getElementById('root'); + const root = document.getElementById("root"); const currentTheme = root.getAttribute("data-theme"); const newTheme = currentTheme === "light" ? "dark" : "light"; root.setAttribute("data-theme", newTheme); + setIsDarkTheme((prev) => !prev); }; return (