'use client';
import {Breadcrumbs, BreadcrumbItem} from '@astryxdesign/core/Breadcrumbs';
import {HStack, VStack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';
import {Button} from '@astryxdesign/core/Button';
import {Icon} from '@astryxdesign/core/Icon';
export interface Crumb {
label: string;
/** Omit on the last crumb — it is the current page. */
href?: string;
}
/**
* Where the operator is, what this page is, and what they can do here.
*
* Breadcrumbs appear only when there is a parent: a top-level page with a
* one-item trail is clutter. Four levels deep (company / store / camera) the
* trail is the only thing telling an operator which tenant they are looking
* at, which on a console that can suspend it is not a nicety.
*/
export function AdminPageHeader({
title,
subtitle,
back,
crumbs,
meta,
actions,
}: {
title: string;
subtitle?: string;
/** One level up. A drill-down page needs a way back that is not the
* browser's — the operator may have arrived from a link. */
back?: {label: string; href: string};
crumbs?: Crumb[];
/** A row under the title — status, slug, dates. */
meta?: React.ReactNode;
actions?: React.ReactNode;
}) {
return (
{back || (crumbs && crumbs.length > 0) ? (
{back ? : null}
{crumbs && crumbs.length > 0 ? (
{crumbs.map((c, i) =>
i === crumbs.length - 1 ? (
{c.label}
) : (
{c.label}
),
)}
) : null}
) : null}
{title}
{subtitle ? (
{subtitle}
) : null}
{meta ? (
{meta}
) : null}
{actions ? (
{actions}
) : null}
);
}
export function BackButton({label, href}: {label: string; href: string}) {
return (
}
/>
);
}