File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11@import 'tailwindcss' ;
22@import 'tw-animate-css' ;
33
4- @custom-variant dark (& : is ( .dark * ));
4+ @custom-variant dark (& : where (. dark , .dark * ));
55
66: root {
77 --background : oklch (0.98 0.01 260 );
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from "react"
22import type { Metadata } from 'next'
33import { Analytics } from '@vercel/analytics/next'
44import './globals.css'
5+ import { ThemeProvider } from "@/components/theme-provider"
56
67export const metadata : Metadata = {
78 title : 'TaskChain' ,
@@ -32,10 +33,16 @@ export default function RootLayout({
3233 children : React . ReactNode
3334} > ) {
3435 return (
35- < html lang = "en" className = "dark" >
36+ < html lang = "en" suppressHydrationWarning >
3637 < body className = { `font-sans antialiased` } >
37- { children }
38- < Analytics />
38+ < ThemeProvider
39+ attribute = "class"
40+ enableSystem = { false }
41+ disableTransitionOnChange
42+ >
43+ { children }
44+ < Analytics />
45+ </ ThemeProvider >
3946 </ body >
4047 </ html >
4148 )
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export function HowItWorks() {
4747 < div key = { step . title } className = "relative" >
4848 < div className = "flex flex-col items-center text-center space-y-4" >
4949 < div className = "relative" >
50- < div className = "absolute -top-4 -left-4 text-6xl font-bold text-primary/10 " >
50+ < div className = "absolute -top-4 -left-4 text-6xl font-bold text-primary/20 " >
5151 { step . number }
5252 </ div >
5353 < div className = "relative h-16 w-16 rounded-full bg-gradient-to-br from-primary to-accent flex items-center justify-center" >
Original file line number Diff line number Diff line change 11"use client" ;
22
3- import { useEffect , useState } from "react" ;
4- import { Sun , Moon } from "lucide-react " ;
3+ import { Moon , Sun } from "lucide- react" ;
4+ import { useTheme } from "next-themes " ;
55
66export function ThemeToggle ( ) {
7- // 1. Initialize state properly to avoid cascading renders
8- const [ dark , setDark ] = useState ( ( ) => {
9- if ( typeof window !== "undefined" ) {
10- return localStorage . getItem ( "theme" ) === "dark" ;
11- }
12- return false ;
13- } ) ;
14-
15- // 2. Synchronize the HTML class with the state
16- useEffect ( ( ) => {
17- if ( dark ) {
18- document . documentElement . classList . add ( "dark" ) ;
19- // eslint-disable-next-line react-hooks/set-state-in-effect
20- setDark ( true ) ;
21- } else {
22- document . documentElement . classList . remove ( "dark" ) ;
23- }
24- } , [ dark ] ) ;
25-
26- const toggleTheme = ( ) => {
27- setDark ( ( prev ) => {
28- const newDark = ! prev ;
29- localStorage . setItem ( "theme" , newDark ? "dark" : "light" ) ;
30- return newDark ;
31- } ) ;
32- } ;
7+ const { theme, setTheme } = useTheme ( ) ;
338
349 return (
3510 < button
36- onClick = { toggleTheme }
11+ onClick = { ( ) => setTheme ( theme === "dark" ? "light" : "dark" ) }
3712 className = "p-2 rounded-lg bg-muted hover:bg-muted/80 transition"
3813 >
39- { dark ? < Sun size = { 18 } /> : < Moon size = { 18 } /> }
14+ { theme === " dark" ? < Sun size = { 18 } /> : < Moon size = { 18 } /> }
4015 </ button >
4116 ) ;
42- }
17+ }
Original file line number Diff line number Diff line change @@ -9,13 +9,13 @@ const buttonVariants = cva(
99 {
1010 variants : {
1111 variant : {
12- default : "bg-primary text-primary-foreground hover:bg-primary/90 " ,
12+ default : "bg-primary text-primary-foreground hover:bg-primary/85 " ,
1313 destructive :
1414 "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60" ,
1515 outline :
1616 "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50" ,
1717 secondary :
18- "bg-secondary text-secondary -foreground hover:bg-secondary/80" ,
18+ "bg-secondary text-primary -foreground hover:bg-secondary/80" ,
1919 ghost :
2020 "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50" ,
2121 link : "text-primary underline-offset-4 hover:underline" ,
You can’t perform that action at this time.
0 commit comments