feat: basic initial UI layout for mobile and desktop
This commit is contained in:
62
apps/web/src/components/layout/Breadcrumb.tsx
Normal file
62
apps/web/src/components/layout/Breadcrumb.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
import { Link, useLocation } from '@tanstack/react-router'
|
||||
import { ChevronRight } from 'lucide-react'
|
||||
|
||||
type Crumb = { label: string; to?: string }
|
||||
|
||||
const BREADCRUMBS: Record<string, Crumb[]> = {
|
||||
'/': [{ label: 'Inicio' }],
|
||||
'/groups': [
|
||||
{ label: 'Inicio', to: '/' },
|
||||
{ label: 'Grupos' },
|
||||
],
|
||||
'/payments': [
|
||||
{ label: 'Inicio', to: '/' },
|
||||
{ label: 'Cobros' },
|
||||
],
|
||||
'/settings': [
|
||||
{ label: 'Inicio', to: '/' },
|
||||
{ label: 'Ajustes' },
|
||||
],
|
||||
'/seguridad': [
|
||||
{ label: 'Inicio', to: '/' },
|
||||
{ label: 'Ajustes', to: '/settings' },
|
||||
{ label: 'Seguridad' },
|
||||
],
|
||||
'/settings/organizations': [
|
||||
{ label: 'Inicio', to: '/' },
|
||||
{ label: 'Ajustes', to: '/settings' },
|
||||
{ label: 'Organizaciones' },
|
||||
],
|
||||
'/profile': [
|
||||
{ label: 'Inicio', to: '/' },
|
||||
{ label: 'Mi perfil' },
|
||||
],
|
||||
}
|
||||
|
||||
export function Breadcrumb() {
|
||||
const location = useLocation()
|
||||
const crumbs = BREADCRUMBS[location.pathname] ?? [{ label: 'Inicio' }]
|
||||
|
||||
return (
|
||||
<nav aria-label="Breadcrumb" className="hidden items-center gap-1.5 text-sm lg:flex">
|
||||
{crumbs.map((crumb, i) => {
|
||||
const isLast = i === crumbs.length - 1
|
||||
return (
|
||||
<span key={crumb.label} className="flex items-center gap-1.5">
|
||||
{i > 0 ? <ChevronRight className="size-3.5 text-foreground/40" /> : null}
|
||||
{isLast ? (
|
||||
<span className="font-medium text-primary">{crumb.label}</span>
|
||||
) : (
|
||||
<Link
|
||||
to={crumb.to!}
|
||||
className="text-foreground/50 transition-colors hover:text-primary"
|
||||
>
|
||||
{crumb.label}
|
||||
</Link>
|
||||
)}
|
||||
</span>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user