wealth/apps/bull/src/app/organisms/auth-top-bar/AuthTopBar.tsx

55 lines
1.7 KiB
TypeScript

import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import { ROUTES } from '@lumina/market/app/navigation';
import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry';
import NextLink from 'next/link';
import { i18n } from '../../../i18n';
import { BackButton } from './components/BackButton';
import type { AuthTopBarProps } from './types';
/**
* The logged-out top bar: the brand and support on a first step; back, the step's name and
* support on a pushed step; only the name on a step with no way back (registration step 4).
* Back keeps what was typed: the number lives in the flow store.
*/
export function AuthTopBar({
title,
back,
brandHref = ROUTES.landing,
}: AuthTopBarProps) {
return (
<FlexBox
tag="header"
alignItems="items-center"
gap="gap-1"
className="sticky top-0 z-sticky min-h-14 border-b border-border-subtle bg-surface px-2"
>
{back && <BackButton step={back} label={i18n.t('auth:header.back')} />}
{title ? (
<Typography
tag="span"
variant="heading-sm"
className={back ? 'flex-1' : 'flex-1 px-2'}
>
{title}
</Typography>
) : (
<FlexBox className="flex-1 px-2">
<Typography
tag={NextLink}
href={brandHref}
aria-label={i18n.t('auth:header.home')}
variant="heading-sm"
color="brand"
className="rounded-xs no-underline focus-visible:focus-ring"
>
{i18n.t('auth:header.brand')}
</Typography>
</FlexBox>
)}
<SupportEntry trigger="icon" placement="bottom" />
</FlexBox>
);
}