blob: c91d514ba75ba563b53cfbc6fe8b81a40f05abbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import { ComponentPropsWithoutRef } from "react";
import classNames from "classnames";
import { ThemeColor } from "./common";
import "./Icon.css";
interface IconButtonProps extends ComponentPropsWithoutRef<"i"> {
icon: string;
color?: ThemeColor | "on-surface";
size?: string | number;
}
export default function Icon(props: IconButtonProps) {
const { icon, color, size, style, className, ...otherProps } = props;
const colorName = color === "on-surface" ? "surface-on" : color ?? "primary";
return (
<i
style={size != null ? { ...style, fontSize: size } : style}
className={classNames(
`bi-${icon} cru-${colorName}-color cru-icon`,
className,
)}
{...otherProps}
/>
);
}
|