diff options
Diffstat (limited to 'FrontEnd/src/views/common/button/FlatButton.tsx')
-rw-r--r-- | FrontEnd/src/views/common/button/FlatButton.tsx | 41 |
1 files changed, 41 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..6351971a --- /dev/null +++ b/FrontEnd/src/views/common/button/FlatButton.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import classNames from "classnames"; + +import { convertI18nText, I18nText } from "@/common"; +import { PaletteColorType } from "@/palette"; + +import "./FlatButton.css"; + +function _FlatButton( + { + text, + color, + onClick, + className, + style, + }: { + text: I18nText; + color?: PaletteColorType; + onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void; + className?: string; + style?: React.CSSProperties; + }, + ref: React.ForwardedRef<HTMLButtonElement> +): React.ReactElement | null { + const { t } = useTranslation(); + + return ( + <button + ref={ref} + className={classNames("cru-flat-button", color ?? "primary", className)} + onClick={onClick} + style={style} + > + {convertI18nText(text, t)} + </button> + ); +} + +const FlatButton = React.forwardRef(_FlatButton); +export default FlatButton; |