diff options
author | crupest <crupest@outlook.com> | 2021-06-26 00:00:54 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-06-26 00:00:54 +0800 |
commit | fa540c046d126449f77e46edd379bbc84e02d05d (patch) | |
tree | 1245f3fb8e9f505809da75a6ffbd2a62b06ebaed /FrontEnd/src/views/common/button/Button.tsx | |
parent | 8ee00da87e2fbfefeefecb01c68a2d297bdfb34b (diff) | |
download | timeline-fa540c046d126449f77e46edd379bbc84e02d05d.tar.gz timeline-fa540c046d126449f77e46edd379bbc84e02d05d.tar.bz2 timeline-fa540c046d126449f77e46edd379bbc84e02d05d.zip |
...
Diffstat (limited to 'FrontEnd/src/views/common/button/Button.tsx')
-rw-r--r-- | FrontEnd/src/views/common/button/Button.tsx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/FrontEnd/src/views/common/button/Button.tsx b/FrontEnd/src/views/common/button/Button.tsx new file mode 100644 index 00000000..11710647 --- /dev/null +++ b/FrontEnd/src/views/common/button/Button.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; + +import { calculateProps, CommonButtonProps } from "./common"; + +import "./Button.css"; + +function _Button( + props: CommonButtonProps & { customButtonClassName?: string }, + ref: React.ForwardedRef<HTMLButtonElement> +): React.ReactElement | null { + const { t } = useTranslation(); + + const { customButtonClassName, ...otherProps } = props; + + const { newProps, children } = calculateProps( + otherProps, + customButtonClassName ?? "cru-button", + t + ); + + return ( + <button ref={ref} {...newProps}> + {children} + </button> + ); +} + +const Button = React.forwardRef(_Button); +export default Button; |