wealth/packages/island/src/molecules/sheet/components/SheetHead.tsx

36 lines
852 B
TypeScript

import { Button } from '../../../atoms/button';
import { FlexBox } from '../../../atoms/flex-box';
import { Typography } from '../../../atoms/typography';
import { cn } from '../../../tools/cn';
import type { SheetHeadProps } from '../types';
export function SheetHead({
title,
titleId,
onClose,
closeLabel,
compact = false,
}: SheetHeadProps) {
return (
<FlexBox
alignItems="items-center"
justifyContent="justify-between"
gap="gap-2"
className={cn('mb-2', !compact && 'min-h-touch-target')}
>
<Typography tag="h2" id={titleId} variant="heading-sm">
{title}
</Typography>
{closeLabel && (
<Button
variant="ghost"
icon="close"
label={closeLabel}
onClick={onClose}
className="-me-2"
/>
)}
</FlexBox>
);
}