From 6b28abc405103b27682882a0abe1d2c980eab135 Mon Sep 17 00:00:00 2001 From: Trey Gordon <41927921+treyg@users.noreply.github.com> Date: Fri, 29 Dec 2023 12:28:43 -0500 Subject: [PATCH 1/2] feat: add new theming options --- components/Navbar.tsx | 30 +++--- components/ToggleDarkMode.tsx | 63 +++++++------ pages/_app.tsx | 102 +++++++++++--------- pages/collections/[id].tsx | 14 +-- pages/settings/appearance.tsx | 173 +++++++++++++++++++--------------- store/localSettings.ts | 41 ++++---- tailwind.config.js | 139 +++++++++++++++++++++++---- 7 files changed, 355 insertions(+), 207 deletions(-) diff --git a/components/Navbar.tsx b/components/Navbar.tsx index fb3678ea..d4fbbdbc 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -26,12 +26,12 @@ export default function Navbar() { const { width } = useWindowDimensions(); const handleToggle = () => { - if (settings.theme === "dark") { - updateSettings({ theme: "light" }); - } else { - updateSettings({ theme: "dark" }); - } + const [colorTheme, mode] = (settings.theme || "default-light").split('-'); + const newMode = mode === "dark" ? "light" : "dark"; + const newTheme = `${colorTheme}-${newMode}`; + updateSettings({ theme: newTheme }); }; + useEffect(() => { setSidebar(false); @@ -135,16 +135,16 @@ export default function Navbar() {
Appearance
+ // Update the theme state + setTheme(newTheme); + }; - -Select Theme
-Dark
- {/*Appearance
+ + +Select Mode
+Light
- {/*Select Color Theme
+- View Your Recently Added Links Here! -
-- This section will view your latest added Links across every - Collections you have access to. -
- -Import From
+ {links[0] ? ( ++ View Your Recently Added Links Here! +
++ This section will view your latest added Links across every + Collections you have access to. +
-Import From
+- Pin Your Favorite Links Here! -
-- You can Pin your favorite Links by clicking on the three dots on - each Link and clicking{" "} - Pin to Dashboard. -
+ {links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? ( ++ Pin Your Favorite Links Here! +
++ You can Pin your favorite Links by clicking on the three dots on + each Link and clicking{" "} + Pin to Dashboard. +
+