shadcn base

This commit is contained in:
wip
2026-11-04 22:31:12 +01:00
commit d16a94324b
94 changed files with 15927 additions and 0 deletions
+114
View File
@@ -0,0 +1,114 @@
import type { ReactNode } from 'react';
import { Bell, Calendar, Kanban, LayoutDashboard, Moon, Search, SquareCheck, Sun, Users } from 'lucide-react';
import { cn } from '../../lib/cn';
import { Avatar, type Person } from '../Avatar/Avatar';
import { Logo } from '../Logo/Logo';
import type { NavItemData } from '../Sidebar/Sidebar';
const tabIcon = { size: 22, strokeWidth: 1.75, 'aria-hidden': true } as const;
export const defaultMobileTabs: NavItemData[] = [
{ id: 'dashboard', label: 'Dashboard', href: '#', icon: <LayoutDashboard {...tabIcon} /> },
{ id: 'aufgaben', label: 'Aufgaben', href: '#', icon: <SquareCheck {...tabIcon} /> },
{ id: 'kanban', label: 'Kanban', href: '#', icon: <Kanban {...tabIcon} /> },
{ id: 'kalender', label: 'Kalender', href: '#', icon: <Calendar {...tabIcon} /> },
{ id: 'gruppen', label: 'Gruppen', href: '#', icon: <Users {...tabIcon} /> },
];
export interface MobileTabBarProps {
items?: NavItemData[];
activeId?: string;
className?: string;
}
/** Sticky bottom navigation on phones. */
export function MobileTabBar({ items = defaultMobileTabs, activeId = 'dashboard', className }: MobileTabBarProps) {
return (
<nav
aria-label="Hauptnavigation"
className={cn(
'sticky bottom-0 z-[5] box-border flex border-t border-line-shell bg-glass-2 px-1.5 pt-1.5 pb-[calc(8px+env(safe-area-inset-bottom))] backdrop-blur-md',
className,
)}
>
{items.map((it) => {
const active = it.id === activeId;
return (
<a
key={it.id}
href={it.href}
aria-current={active ? 'page' : undefined}
className={cn(
'flex h-[52px] min-w-0 flex-1 basis-0 flex-col items-center justify-center gap-1 rounded-[10px] text-2xs font-bold',
active ? 'text-accent-fg hover:text-accent-fg' : 'text-fg-subtle hover:text-fg',
)}
>
{it.icon}
{it.label}
</a>
);
})}
</nav>
);
}
export interface MobileHeaderProps {
user: Person;
theme?: 'dark' | 'light';
onToggleTheme?: () => void;
onSearch?: () => void;
unreadCount?: number;
notificationsHref?: string;
onProfile?: () => void;
/** Replaces the logo, e.g. a back button and page title. */
leading?: ReactNode;
className?: string;
}
/** Sticky glass header on phones: logo, theme, search, notifications, profile. */
export function MobileHeader({
user,
theme = 'dark',
onToggleTheme,
onSearch,
unreadCount = 0,
notificationsHref = '#',
onProfile,
leading,
className,
}: MobileHeaderProps) {
const btn = 'flex h-11 w-11 flex-none items-center justify-center rounded-[10px] text-fg-4 hover:bg-hover hover:text-fg';
const themeLabel = theme === 'dark' ? 'Helles Design aktivieren' : 'Dunkles Design aktivieren';
return (
<header
className={cn(
'sticky top-0 z-[5] box-border flex h-14 items-center gap-2.5 border-b border-line-shell bg-glass pr-2 pl-4 backdrop-blur-md',
className,
)}
>
{leading ?? <Logo className="h-6" />}
<div className="ml-auto flex items-center">
<button type="button" onClick={onToggleTheme} aria-label={themeLabel} title={themeLabel} className={btn}>
{theme === 'dark' ? <Sun size={18} strokeWidth={1.75} /> : <Moon size={18} strokeWidth={1.75} />}
</button>
<button type="button" onClick={onSearch} aria-label="Suchen" className={btn}>
<Search size={20} strokeWidth={1.75} />
</button>
<a href={notificationsHref} aria-label={`Benachrichtigungen, ${unreadCount} ungelesen`} className={cn(btn, 'relative')}>
<Bell size={20} strokeWidth={1.75} />
{unreadCount > 0 && (
<span className="absolute top-[11px] right-3 h-[7px] w-[7px] rounded-full bg-danger shadow-[0_0_0_2px_var(--cl-app)]" />
)}
</a>
<button
type="button"
onClick={onProfile}
aria-label="Profil und Einstellungen"
className="flex h-11 w-11 items-center justify-center p-0"
>
<Avatar person={user} size={30} aria-hidden="true" />
</button>
</div>
</header>
);
}