aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/common/button/IconButton.tsx
blob: 3ba56277f7a28afddbfe35a5184f3807149b3580 (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 * as React from "react";
import classNames from "classnames";

import { PaletteColorType } from "@/palette";

import "./IconButton.css";

export interface IconButtonProps extends React.ComponentPropsWithRef<"i"> {
  icon: string;
  color?: PaletteColorType;
  large?: boolean;
}

export default function IconButton(props: IconButtonProps): JSX.Element {
  const { icon, color, className, large, ...otherProps } = props;

  return (
    <i
      className={classNames(
        "cru-icon-button",
        large && "large",
        "bi-" + icon,
        color ? "cru-" + color : "cru-primary",
        className,
      )}
      {...otherProps}
    />
  );
}