wealth/packages/island/src/molecules/sample-frame/SampleFrame.tsx

55 lines
1.3 KiB
TypeScript

import { FlexBox } from '../../atoms/flex-box';
import { Icon } from '../../atoms/icon';
import { Typography } from '../../atoms/typography';
import type { SampleFrameProps } from './types';
import { sampleTagVariants } from './variants';
/**
* A picture of the product made of its real components with made-up data: labelled «نمونه», never
* focusable or clickable, and hidden from screen readers, which read the caption instead.
*/
export function SampleFrame({
tag,
caption,
tone,
children,
className,
}: SampleFrameProps) {
return (
<FlexBox
tag="figure"
direction="flex-col"
gap="gap-2"
className={className}
>
<FlexBox
alignItems="items-center"
gap="gap-1"
className={sampleTagVariants({ tone })}
>
<Icon name="eye" size={16} />
<Typography
tag="span"
variant="caption"
color="inherit"
className="font-semibold"
>
{tag}
</Typography>
</FlexBox>
<FlexBox
direction="flex-col"
gap="gap-3"
inert
aria-hidden
className="pointer-events-none select-none"
>
{children}
</FlexBox>
<Typography tag="figcaption" variant="caption" color="secondary">
{caption}
</Typography>
</FlexBox>
);
}