diff options
author | crupest <crupest@outlook.com> | 2021-06-15 16:23:44 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-06-15 16:23:44 +0800 |
commit | ddce03a67708249eec129eb36744be460345bd75 (patch) | |
tree | 58417f657467e89d06c58b848db621c021803254 /FrontEnd/src/views/common/button/FlatButton.tsx | |
parent | e0b766203d7576ab67b16ba556ba14120d0bc876 (diff) | |
download | timeline-ddce03a67708249eec129eb36744be460345bd75.tar.gz timeline-ddce03a67708249eec129eb36744be460345bd75.tar.bz2 timeline-ddce03a67708249eec129eb36744be460345bd75.zip |
...
Diffstat (limited to 'FrontEnd/src/views/common/button/FlatButton.tsx')
-rw-r--r-- | FrontEnd/src/views/common/button/FlatButton.tsx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/FrontEnd/src/views/common/button/FlatButton.tsx b/FrontEnd/src/views/common/button/FlatButton.tsx new file mode 100644 index 00000000..0727eb88 --- /dev/null +++ b/FrontEnd/src/views/common/button/FlatButton.tsx @@ -0,0 +1,36 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; + +import { convertI18nText, I18nText } from "@/common"; +import { PaletteColorType } from "@/palette"; + +import "./FlatButton.css"; +import classNames from "classnames"; + +function _FlatButton( + { + text, + color, + onClick, + }: { + text: I18nText; + color?: PaletteColorType; + onClick?: () => void; + }, + ref: React.ForwardedRef<HTMLButtonElement> +): React.ReactElement | null { + const { t } = useTranslation(); + + return ( + <button + ref={ref} + className={classNames("cru-flat-button", color ?? "primary")} + onClick={onClick} + > + {convertI18nText(text, t)} + </button> + ); +} + +const FlatButton = React.forwardRef(_FlatButton); +export default FlatButton; |