mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-20 07:41:22 +02:00
Started on general window layout
This commit is contained in:
34
src-web/components/Icon.tsx
Normal file
34
src-web/components/Icon.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { ComponentType } from 'react';
|
||||
import {
|
||||
ArchiveIcon,
|
||||
CameraIcon,
|
||||
ChevronDownIcon,
|
||||
GearIcon,
|
||||
HomeIcon,
|
||||
TriangleDownIcon,
|
||||
} from '@radix-ui/react-icons';
|
||||
import classnames from 'classnames';
|
||||
|
||||
type IconName = 'archive' | 'home' | 'camera' | 'gear' | 'triangle-down';
|
||||
|
||||
const icons: Record<IconName, ComponentType> = {
|
||||
archive: ArchiveIcon,
|
||||
home: HomeIcon,
|
||||
camera: CameraIcon,
|
||||
gear: GearIcon,
|
||||
'triangle-down': TriangleDownIcon,
|
||||
};
|
||||
|
||||
export interface IconProps {
|
||||
icon: IconName;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function Icon({ icon, className }: IconProps) {
|
||||
const Component = icons[icon];
|
||||
return (
|
||||
<div className={classnames(className, 'flex items-center')}>
|
||||
<Component />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user