aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/common/ToggleIconButton.tsx
blob: c4d2d132b14f7ba7c230c410048264c494fadec4 (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
30
import React from "react";
import classnames from "classnames";

export interface ToggleIconButtonProps
  extends React.HTMLAttributes<HTMLElement> {
  state: boolean;
  trueIconClassName: string;
  falseIconClassName: string;
}

const ToggleIconButton: React.FC<ToggleIconButtonProps> = ({
  state,
  className,
  trueIconClassName,
  falseIconClassName,
  ...otherProps
}) => {
  return (
    <i
      className={classnames(
        state ? trueIconClassName : falseIconClassName,
        "icon-button",
        className
      )}
      {...otherProps}
    />
  );
};

export default ToggleIconButton;