Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@
@custom-variant dark (&:is(.dark *));

:root {
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--background: oklch(0.99 0 0);
--foreground: oklch(0.09 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--card-foreground: oklch(0.09 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--destructive-foreground: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--popover-foreground: oklch(0.09 0 0);
--primary: oklch(0.45 0.22 285);
--primary-foreground: oklch(0.99 0 0);
--secondary: oklch(0.50 0.18 200);
--secondary-foreground: oklch(0.99 0 0);
--muted: oklch(0.96 0 0);
--muted-foreground: oklch(0.45 0 0);
--accent: oklch(0.55 0.2 195);
--accent-foreground: oklch(0.99 0 0);
--destructive: oklch(0.55 0.22 25);
--destructive-foreground: oklch(0.99 0 0);
--border: oklch(0.88 0 0);
--input: oklch(0.88 0 0);
--ring: oklch(0.45 0.22 285);
--chart-1: oklch(0.50 0.22 285);
--chart-2: oklch(0.50 0.18 200);
--chart-3: oklch(0.55 0.2 195);
--chart-4: oklch(0.55 0.15 160);
--chart-5: oklch(0.60 0.12 180);
--radius: 0.625rem;
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
--sidebar: oklch(0.99 0 0);
--sidebar-foreground: oklch(0.09 0 0);
--sidebar-primary: oklch(0.45 0.22 285);
--sidebar-primary-foreground: oklch(0.99 0 0);
--sidebar-accent: oklch(0.96 0 0);
--sidebar-accent-foreground: oklch(0.09 0 0);
--sidebar-border: oklch(0.88 0 0);
--sidebar-ring: oklch(0.45 0.22 285);
}

.dark {
Expand Down
14 changes: 11 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react"
import type { Metadata } from 'next'
import { Geist, Geist_Mono } from 'next/font/google'
import { Analytics } from '@vercel/analytics/next'
import { ThemeProvider } from '@/components/theme-provider'
import './globals.css'

const _geist = Geist({ subsets: ["latin"] });
Expand Down Expand Up @@ -36,10 +37,17 @@ export default function RootLayout({
children: React.ReactNode
}>) {
return (
<html lang="en" className="dark">
<html lang="en" suppressHydrationWarning>
<body className={`font-sans antialiased`}>
{children}
<Analytics />
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
<Analytics />
</ThemeProvider>
</body>
</html>
)
Expand Down
8 changes: 7 additions & 1 deletion components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import Link from 'next/link'
import { Button } from '@/components/ui/button'
import { ThemeToggle } from '@/components/theme-toggle'
import { Menu, X } from 'lucide-react'
import { useState } from 'react'

Expand All @@ -13,7 +14,7 @@ export function Navbar() {
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div className="flex h-16 items-center justify-between">
<div className="flex items-center gap-2">
<div className="h-8 w-8 rounded-lg bg-gradient-to-br from-primary via-secondary to-accent" />
<div className="h-8 w-8 rounded-lg bg-linear-to-br from-primary via-secondary to-accent" />
<span className="text-xl font-bold text-foreground">TaskChain</span>
</div>

Expand All @@ -33,6 +34,7 @@ export function Navbar() {
</div>

<div className="hidden md:flex items-center gap-4">
<ThemeToggle />
<Button variant="ghost" asChild>
<Link href="/login">Login</Link>
</Button>
Expand Down Expand Up @@ -66,6 +68,10 @@ export function Navbar() {
Testimonials
</Link>
<div className="pt-4 space-y-2">
<div className="flex items-center justify-between pb-2">
<span className="text-sm text-muted-foreground">Theme</span>
<ThemeToggle />
</div>
<Button variant="ghost" className="w-full" asChild>
<Link href="/login">Login</Link>
</Button>
Expand Down
40 changes: 40 additions & 0 deletions components/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use client'

import * as React from 'react'
import { Moon, Sun } from 'lucide-react'
import { useTheme } from 'next-themes'
import { Button } from '@/components/ui/button'

export function ThemeToggle() {
const { theme, setTheme } = useTheme()
const [mounted, setMounted] = React.useState(false)

// Avoid hydration mismatch
React.useEffect(() => {
setMounted(true)
}, [])

if (!mounted) {
return (
<Button variant="ghost" size="icon" className="h-9 w-9">
<Sun className="h-5 w-5" />
</Button>
)
}

return (
<Button
variant="ghost"
size="icon"
className="h-9 w-9"
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
aria-label="Toggle theme"
>
{theme === 'dark' ? (
<Sun className="h-5 w-5 text-muted-foreground hover:text-foreground transition-colors" />
) : (
<Moon className="h-5 w-5 text-muted-foreground hover:text-foreground transition-colors" />
)}
</Button>
)
}