1 import { c } from 'ttag';
3 import { Button } from '@proton/atoms';
4 import type { Shape } from '@proton/components/components/button/ButtonGroup';
5 import clsx from '@proton/utils/clsx';
7 import type { ThemeSvgColors, ThemeSvgSize } from './ThemeSvg';
8 import ThemeSvg from './ThemeSvg';
10 import './ThemeCard.scss';
16 colors: ThemeSvgColors;
18 onChange?: () => void;
20 as?: React.ElementType;
22 borderRadius?: 'sm' | 'md';
24 'data-testid'?: string;
36 as: Component = Button,
37 shapeButton = 'outline',
39 'data-testid': dataTestId,
45 color={selected ? 'norm' : 'weak'}
48 'theme-card-button p-0 flex flex-nowrap flex-column gap-1 items-center',
49 selected && 'is-active pointer-events-none text-bold',
50 Component === Button && 'w-full interactive-pseudo',
51 borderRadius === 'sm' && 'rounded-sm',
52 borderRadius === 'md' && 'rounded',
53 `theme-card-button-${size}`,
56 aria-pressed={Component === Button ? selected : undefined}
59 type={Component === Button ? 'button' : undefined}
60 aria-label={c('Action').t`Use ${label} theme`}
61 title={c('Action').t`Use ${label} theme`}
62 data-testid={dataTestId}
64 <ThemeSvg className={clsx('block theme-card-image rtl:mirror')} size={size} colors={colors} />
67 size === 'small' && 'sr-only',
68 size === 'medium' && 'sr-only',
69 size === 'medium-wide' && 'text-sm'
78 export default ThemeCard;