mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-08 11:44:05 +00:00
809cf636d4
* Fix icons on light theme * more icons * more icons * update icons * assets gen
24 lines
537 B
TypeScript
24 lines
537 B
TypeScript
import { getIcon, iconNames } from '@sd/assets/util';
|
|
import { ImgHTMLAttributes } from 'react';
|
|
import { useIsDark } from '~/hooks';
|
|
|
|
export type IconName = keyof typeof iconNames;
|
|
|
|
interface Props extends ImgHTMLAttributes<HTMLImageElement> {
|
|
name: IconName;
|
|
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}
|
|
/>
|
|
);
|
|
};
|