mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-19 13:55:40 -04:00
[ENG-1262] Icon component for sd icons (#1550)
icon component for sd icons
This commit is contained in:
13
interface/components/Icon.tsx
Normal file
13
interface/components/Icon.tsx
Normal 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} />;
|
||||
};
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user