aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/components/Icon.tsx
blob: e5cf598e528f36df43321f604c281375b414b428 (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
import { ComponentPropsWithoutRef } from "react";
import classNames from "classnames";

import { ThemeColor } from "./common";

import "./Icon.css";

interface IconButtonProps extends ComponentPropsWithoutRef<"i"> {
  icon: string;
  color?: ThemeColor;
  size?: string | number;
}

export default function Icon(props: IconButtonProps) {
  const { icon, color, size, style, className, ...otherProps } = props;

  return (
    <i
      style={size != null ? { ...style, fontSize: size } : style}
      className={classNames(
        `cru-theme-${color ?? "primary"}`,
        `bi-${icon} cru-icon`,
        className,
      )}
      {...otherProps}
    />
  );
}