diff options
author | crupest <crupest@outlook.com> | 2021-01-11 22:28:58 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-01-11 22:28:58 +0800 |
commit | c4eaeee3203a8ed2ebfa4bc792ada3ec4703438e (patch) | |
tree | bb61295a9f7faf5ad73ca197133e7257e5f95f1d /FrontEnd/src/app/views/common/ToggleIconButton.tsx | |
parent | 5f08a5afe39fb680a14982255d366335bcef5d6e (diff) | |
download | timeline-c4eaeee3203a8ed2ebfa4bc792ada3ec4703438e.tar.gz timeline-c4eaeee3203a8ed2ebfa4bc792ada3ec4703438e.tar.bz2 timeline-c4eaeee3203a8ed2ebfa4bc792ada3ec4703438e.zip |
feat: Fix #200.
Diffstat (limited to 'FrontEnd/src/app/views/common/ToggleIconButton.tsx')
-rw-r--r-- | FrontEnd/src/app/views/common/ToggleIconButton.tsx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/FrontEnd/src/app/views/common/ToggleIconButton.tsx b/FrontEnd/src/app/views/common/ToggleIconButton.tsx new file mode 100644 index 00000000..76c48960 --- /dev/null +++ b/FrontEnd/src/app/views/common/ToggleIconButton.tsx @@ -0,0 +1,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; |