forked from rajun/ar-test
feat: add icon tile component
This commit is contained in:
parent
8592c51e1a
commit
cbd23f2902
32
app/components/ui/icon-tile.tsx
Normal file
32
app/components/ui/icon-tile.tsx
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
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>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user