aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/views/common/ToggleIconButton.tsx
blob: 76c48960f69337b312e430576122df4a5498e94c (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 clsx from "clsx";

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={clsx(
        state ? trueIconClassName : falseIconClassName,
        "icon-button",
        className
      )}
      {...otherProps}
    />
  );
};

export default ToggleIconButton;