spacedrive/interface/components/Icon.tsx
Jamie Pine fdf31fc3a8
[ENG-1511] Library Screens (#1903)
* init

* changes

* Now updating statistics once a minute

* More robust statistics updater

* Concurrency is hard

* improvements to stats

* refactor

* adjust setting back/forward padding so it matches top bar

* refactor sidebar

* rename

* setting up screens

* some changes

* Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com>

* yes

* yes2

* refactored explorerItem.ts

* important explorer code shouldn't be thrown away in a util moment

* support for multiple thumbnails in ExplorerItem

* clippy

* move debug

* yes

* label filters

* ts

* comment out unconnected stuff

* added .mid for midi files

---------

Co-authored-by: Ericson Fogo Soares <ericson.ds999@gmail.com>
Co-authored-by: Brendan Allan <brendonovich@outlook.com>
2024-01-16 12:15:03 +00:00

26 lines
622 B
TypeScript

import { getIcon, iconNames } from '@sd/assets/util';
import clsx from 'clsx';
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}
className={clsx('pointer-events-none', props.className)}
/>
);
};