import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from '@/components/ui/breadcrumb' import { getCachedGlobal } from '@/utilities/globals' import Link from 'next/link' import { Fragment } from 'react' import { SocialLinks } from './socialLinks' export type Crumb = { label: string /** Omit on the current (last) crumb so it renders as plain text. */ href?: string } type SiteHeaderProps = { /** * Breadcrumb trail rendered on the light sub-bar. When empty (e.g. on the * home page) no breadcrumb bar is shown. */ breadcrumbs?: Crumb[] /** * `solid` renders a brand-red bar that participates in the layout flow and * sticks to the top of its scroll container (used on the Posts pages). * `overlay` floats transparently over hero content (used on the home page). */ variant?: 'solid' | 'overlay' } const HOME_LABEL = 'InĂ­cio' export const SiteHeader = async ({ breadcrumbs = [], variant = 'solid' }: SiteHeaderProps) => { const settings = await getCachedGlobal('site-settings', 2)() const title = settings.headerTitle?.trim() || 'Jorge Solla' if (variant === 'overlay') { return (

{title}

) } const trail: Crumb[] = [{ label: HOME_LABEL, href: '/' }, ...breadcrumbs] return (
{title}
{trail.length > 1 ? (
{trail.map((crumb, index) => { const isLast = index === trail.length - 1 return ( {isLast || !crumb.href ? ( {crumb.label} ) : ( {crumb.label} )} {isLast ? null : } ) })}
) : null}
) }