Files
web/src/components/icon.tsx
2024-12-29 19:15:04 +00:00

26 lines
518 B
TypeScript

import classNames from "classnames";
import { MouseEventHandler } from "react";
type Props = {
name: string;
size?: number;
className?: string;
onClick?: MouseEventHandler<SVGSVGElement>;
};
export function Icon(props: Props) {
const size = props.size || 20;
const href = `/icons.svg#${props.name}`;
return (
<svg
width={size}
height={size}
className={classNames(props.className, "cursor-pointer")}
onClick={props.onClick}
>
<use href={href} />
</svg>
);
}