From af72ae9db2f1188cd7ade6bf8c2f4c2fd7f865bc Mon Sep 17 00:00:00 2001 From: thomasgross Date: Thu, 5 Dec 2024 10:45:16 +0100 Subject: [PATCH] feat: add animation for header switch and remove global transition for now --- components/global/header/Header.tsx | 2 +- .../shared/darkModeToggle/DarkModeToggle.tsx | 31 +++++++++++++++---- public/icons/moon.svg | 4 +++ public/icons/sun.svg | 11 +++++++ styles/globals.css | 12 ------- tailwind.config.ts | 3 -- 6 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 public/icons/moon.svg create mode 100644 public/icons/sun.svg diff --git a/components/global/header/Header.tsx b/components/global/header/Header.tsx index 7c753400..7e6d428b 100644 --- a/components/global/header/Header.tsx +++ b/components/global/header/Header.tsx @@ -10,7 +10,7 @@ import ProfileButton from "./ProfileButton" function Header() { return (
-
+

Biblioterernes ebøger og lydbøger

diff --git a/components/shared/darkModeToggle/DarkModeToggle.tsx b/components/shared/darkModeToggle/DarkModeToggle.tsx index 95204c4f..6de098cb 100644 --- a/components/shared/darkModeToggle/DarkModeToggle.tsx +++ b/components/shared/darkModeToggle/DarkModeToggle.tsx @@ -3,6 +3,7 @@ import React from "react" import Icon from "@/components/shared/icon/Icon" +import { cn } from "@/lib/helpers/helper.cn" import { useThemeStore } from "@/store/theme.store" function DarkModeToggle() { @@ -10,13 +11,31 @@ function DarkModeToggle() { return ( ) } diff --git a/public/icons/moon.svg b/public/icons/moon.svg new file mode 100644 index 00000000..a40c84a5 --- /dev/null +++ b/public/icons/moon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/icons/sun.svg b/public/icons/sun.svg new file mode 100644 index 00000000..8813b1e7 --- /dev/null +++ b/public/icons/sun.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/styles/globals.css b/styles/globals.css index 74875de7..904ae386 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -318,18 +318,6 @@ @apply mx-auto w-full max-w-[var(--page-width)] px-[var(--grid-edge)]; } -.dark-mode-transition { - @apply transition-[background] duration-dark-mode; -} - -body { - @apply bg-background font-body text-foreground transition-all duration-dark-mode; -} - -body > * { - @apply dark-mode-transition bg-background transition-all; -} - .focus-visible { @apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground focus-visible:ring-offset-2; } diff --git a/tailwind.config.ts b/tailwind.config.ts index ce0dffa9..a7e3fd34 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -273,9 +273,6 @@ export const extendedTheme = { }, }, }, - transitionDuration: { - "dark-mode": "var(--dark-mode-transition)", - }, keyframes: { wiggle: { "10% 90%": { transform: "rotate(10.0deg)" },