ar-test/app/components/ui/icon-tile.tsx

33 lines
980 B
TypeScript

import type { LucideIcon } from 'lucide-react';
import { cva } from 'class-variance-authority';
import { toneSurface, type Tone } from '~/components/ui/tone';
import { cn } from '~/lib/utils';
const tileSize = cva('flex shrink-0 items-center justify-center', {
variants: {
size: {
sm: 'h-9 w-9 rounded-item',
md: 'h-10 w-10 rounded-group',
lg: 'h-12 w-12 rounded-card-sm',
xl: 'h-14 w-14 rounded-card',
},
},
});
const ICON_SIZE = { sm: 16, md: 18, lg: 22, xl: 24 } as const;
interface IconTileProps {
icon: LucideIcon;
tone?: Tone;
size?: keyof typeof ICON_SIZE;
className?: string;
}
export function IconTile({ icon: Icon, tone = 'primary', size = 'md', className }: IconTileProps) {
return (
<div className={cn(toneSurface({ tone }), tileSize({ size }), tone === 'neutral' && 'text-primary', className)}>
<Icon size={ICON_SIZE[size]} />
</div>
);
}