feat: complete UI design system refactoring and fix TS build errors
This commit is contained in:
1 parent
0b1ffdfdfc
commit
8728308fc6
27 files changed
+847
-370
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { authClient } from "@/modules/auth/client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
// Renders into the portal masthead. Better Auth's signOut clears the session
|
||||
// cookie server-side; we then hard-navigate to the login page so no stale
|
||||
@@ -20,8 +21,14 @@ export function LogoutButton() {
|
||||
}
|
||||
|
||||
return (
|
||||
<button className="portal-signout" disabled={pending} onClick={signOut} type="button">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={pending}
|
||||
onClick={signOut}
|
||||
type="button"
|
||||
>
|
||||
{pending ? "…" : "Abmelden"}
|
||||
</button>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import Link from "next/link";
|
||||
|
||||
import { BrandLogo } from "@/components/brand/logo";
|
||||
import { LogoutButton } from "@/components/layout/logout-button";
|
||||
import { ThemeToggle } from "@/components/theme-toggle";
|
||||
|
||||
export type NavItem = { href: string; label: string };
|
||||
|
||||
@@ -27,24 +28,35 @@ export function PortalShell({
|
||||
children,
|
||||
}: Readonly<PortalShellProps>) {
|
||||
return (
|
||||
<div className="editorial-shell">
|
||||
<header className="portal-masthead">
|
||||
<Link aria-label={sectionLabel} className="portal-brand" href={brandHref}>
|
||||
<BrandLogo variant="white" />
|
||||
</Link>
|
||||
<div className="portal-masthead-meta">
|
||||
<span>{sectionLabel}</span>
|
||||
<nav aria-label={sectionLabel}>
|
||||
{nav.map((item) => (
|
||||
<Link key={item.href} href={item.href}>
|
||||
{item.label}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
<LogoutButton />
|
||||
<div className="min-h-screen bg-background flex flex-col">
|
||||
<header className="sticky top-0 z-50 w-full border-b border-border/40 bg-background/80 backdrop-blur-md transition-colors duration-300">
|
||||
<div className="flex h-16 items-center justify-between px-6 lg:px-12">
|
||||
<Link aria-label={sectionLabel} className="flex items-center gap-2 transition-opacity hover:opacity-80" href={brandHref}>
|
||||
{/* The BrandLogo might need to be theme-aware or we just use white/black depending on theme */}
|
||||
<div className="dark:hidden flex items-center"><BrandLogo variant="black" /></div>
|
||||
<div className="hidden dark:flex items-center"><BrandLogo variant="white" /></div>
|
||||
</Link>
|
||||
<div className="flex items-center gap-6 text-sm font-medium">
|
||||
<span className="hidden md:inline-block text-muted-foreground uppercase tracking-widest text-xs font-bold">{sectionLabel}</span>
|
||||
<nav aria-label={sectionLabel} className="hidden sm:flex items-center gap-6">
|
||||
{nav.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className="transition-colors hover:text-primary-500 text-foreground"
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
<div className="flex items-center gap-4">
|
||||
<ThemeToggle />
|
||||
<LogoutButton />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main className={mainClassName}>{children}</main>
|
||||
<main className="flex-1 w-full max-w-7xl mx-auto px-6 py-12 lg:px-12 lg:py-16">{children}</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import * as React from "react";
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import type { ThemeProviderProps } from "next-themes";
|
||||
|
||||
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
||||
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
"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 <div className="w-9 h-9" /> // Placeholder to prevent layout shift
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => setTheme(theme === "light" ? "dark" : "light")}
|
||||
title="Design umschalten"
|
||||
>
|
||||
{theme === "light" ? (
|
||||
<Sun className="h-[1.2rem] w-[1.2rem] transition-all" />
|
||||
) : (
|
||||
<Moon className="h-[1.2rem] w-[1.2rem] transition-all" />
|
||||
)}
|
||||
<span className="sr-only">Design umschalten</span>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import * as React from "react"
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
export interface ButtonProps
|
||||
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
asChild?: boolean
|
||||
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"
|
||||
size?: "default" | "sm" | "lg" | "icon"
|
||||
}
|
||||
|
||||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
({ className, variant = "default", size = "default", asChild = false, ...props }, ref) => {
|
||||
const Comp = asChild ? Slot : "button"
|
||||
|
||||
// Wir nutzen hier klassische Tailwind-Klassen kombiniert mit unseren CSS Variablen
|
||||
const baseClasses = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-500 disabled:pointer-events-none disabled:opacity-50"
|
||||
|
||||
const variantClasses = {
|
||||
default: "bg-primary-600 text-white hover:bg-primary-700 shadow-sm",
|
||||
destructive: "bg-red-500 text-white hover:bg-red-600 shadow-sm",
|
||||
outline: "border border-border bg-background hover:bg-accent hover:text-accent-foreground shadow-sm",
|
||||
secondary: "bg-gray-100 text-gray-900 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700",
|
||||
ghost: "hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-100",
|
||||
link: "text-primary-600 underline-offset-4 hover:underline",
|
||||
}
|
||||
|
||||
const sizeClasses = {
|
||||
default: "h-9 px-4 py-2",
|
||||
sm: "h-8 rounded-md px-3 text-xs",
|
||||
lg: "h-10 rounded-md px-8",
|
||||
icon: "h-9 w-9",
|
||||
}
|
||||
|
||||
return (
|
||||
<Comp
|
||||
className={cn(baseClasses, variantClasses[variant], sizeClasses[size], className)}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
Button.displayName = "Button"
|
||||
|
||||
export { Button }
|
||||
@@ -0,0 +1,70 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"rounded-xl border border-border bg-card text-card-foreground shadow-sm overflow-hidden",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
)
|
||||
Card.displayName = "Card"
|
||||
|
||||
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
)
|
||||
CardHeader.displayName = "CardHeader"
|
||||
|
||||
const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<h3
|
||||
ref={ref}
|
||||
className={cn("text-2xl font-semibold leading-none tracking-tight", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
)
|
||||
CardTitle.displayName = "CardTitle"
|
||||
|
||||
const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<p
|
||||
ref={ref}
|
||||
className={cn("text-sm text-gray-500 dark:text-gray-400", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
)
|
||||
CardDescription.displayName = "CardDescription"
|
||||
|
||||
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
||||
)
|
||||
)
|
||||
CardContent.displayName = "CardContent"
|
||||
|
||||
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("flex items-center p-6 pt-0", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
)
|
||||
CardFooter.displayName = "CardFooter"
|
||||
|
||||
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
export interface InputProps
|
||||
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
||||
|
||||
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||
({ className, type, ...props }, ref) => {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
className={cn(
|
||||
"flex h-10 w-full rounded-md border border-border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-gray-400",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
Input.displayName = "Input"
|
||||
|
||||
export { Input }
|
||||
Reference in new issue
Block a user