diff options
author | crupest <crupest@outlook.com> | 2021-06-15 16:41:03 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-06-15 16:41:03 +0800 |
commit | 8c56e3fd388005bcb7aced75b73d7018511ceac8 (patch) | |
tree | a1a0138a52aa048ec8e6a35f1cfe2bbd85c8c684 /FrontEnd/src/views/common/button/TextButton.tsx | |
parent | ddce03a67708249eec129eb36744be460345bd75 (diff) | |
download | timeline-8c56e3fd388005bcb7aced75b73d7018511ceac8.tar.gz timeline-8c56e3fd388005bcb7aced75b73d7018511ceac8.tar.bz2 timeline-8c56e3fd388005bcb7aced75b73d7018511ceac8.zip |
...
Diffstat (limited to 'FrontEnd/src/views/common/button/TextButton.tsx')
-rw-r--r-- | FrontEnd/src/views/common/button/TextButton.tsx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/FrontEnd/src/views/common/button/TextButton.tsx b/FrontEnd/src/views/common/button/TextButton.tsx new file mode 100644 index 00000000..2014158a --- /dev/null +++ b/FrontEnd/src/views/common/button/TextButton.tsx @@ -0,0 +1,36 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import classNames from "classnames"; + +import { convertI18nText, I18nText } from "@/common"; +import { PaletteColorType } from "@/palette"; + +import "./TextButton.css"; + +function _TextButton( + { + 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-text-button", color ?? "primary")} + onClick={onClick} + > + {convertI18nText(text, t)} + </button> + ); +} + +const TextButton = React.forwardRef(_TextButton); +export default TextButton; |