Files
spacedrive/interface/components/Icon.tsx
ameer2468 2b52555c2b [ENG-1193] Added icons to dialogs (#1708)
* Added icons to dialogs

* update file/folder icon when deleting

* tweaks

* ts

* ts
2023-10-30 16:46:12 +00:00

22 lines
497 B
TypeScript

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;
theme?: 'dark' | 'light';
}
export const Icon = ({ name, size, theme, ...props }: Props) => {
const isDark = useIsDark();
return (
<img
src={getIcon(name, theme ? theme === 'dark' : isDark)}
width={size}
height={size}
{...props}
/>
);
};