[ENG-1262] Icon component for sd icons (#1550)

icon component for sd icons
This commit is contained in:
nikec
2023-10-13 01:05:43 +02:00
committed by GitHub
parent 18de4bca15
commit ebd53e8173
2 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
import { getIcon, iconNames } from '@sd/assets/util';
import { HTMLAttributes } from 'react';
import { useIsDark } from '~/hooks';
interface Props extends HTMLAttributes<HTMLImageElement> {
name: keyof typeof iconNames;
size?: number;
}
export const Icon = ({ name, size, ...props }: Props) => {
const isDark = useIsDark();
return <img src={getIcon(name, isDark)} width={size} height={size} {...props} />;
};

View File

@@ -5,9 +5,10 @@ export * from './DismissibleNotice';
export * from './DragRegion';
export * from './Folder';
export * from './GridList';
export * from './Icon';
export * from './Loader';
export * from './PDFViewer';
export * from './TextViewer';
export * from './PasswordMeter';
export * from './SubtleButton';
export * from './TextViewer';
export * from './TrafficLights';
export * from './Loader';