diff options
Diffstat (limited to 'FrontEnd/src/views/common/button')
-rw-r--r-- | FrontEnd/src/views/common/button/FlatButton.tsx | 2 | ||||
-rw-r--r-- | FrontEnd/src/views/common/button/TextButton.css | 36 | ||||
-rw-r--r-- | FrontEnd/src/views/common/button/TextButton.tsx | 36 |
3 files changed, 73 insertions, 1 deletions
diff --git a/FrontEnd/src/views/common/button/FlatButton.tsx b/FrontEnd/src/views/common/button/FlatButton.tsx index 0727eb88..24f47785 100644 --- a/FrontEnd/src/views/common/button/FlatButton.tsx +++ b/FrontEnd/src/views/common/button/FlatButton.tsx @@ -1,11 +1,11 @@ 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"; -import classNames from "classnames"; function _FlatButton( { diff --git a/FrontEnd/src/views/common/button/TextButton.css b/FrontEnd/src/views/common/button/TextButton.css new file mode 100644 index 00000000..dc5abaaa --- /dev/null +++ b/FrontEnd/src/views/common/button/TextButton.css @@ -0,0 +1,36 @@ +.cru-text-button {
+ background: transparent;
+ border: none;
+}
+
+.cru-text-button.primary {
+ color: var(--tl-primary-color);
+}
+
+.cru-text-button.primary:hover {
+ color: var(--tl-primary-lighter-color);
+}
+
+.cru-text-button.secondary {
+ color: var(--tl-secondary-color);
+}
+
+.cru-text-button.secondary:hover {
+ color: var(--tl-secondary-lighter-color);
+}
+
+.cru-text-button.success {
+ color: var(--tl-success-color);
+}
+
+.cru-text-button.success:hover {
+ color: var(--tl-success-lighter-color);
+}
+
+.cru-text-button.danger {
+ color: var(--tl-danger-color);
+}
+
+.cru-text-button.danger:hover {
+ color: var(--tl-danger-lighter-color);
+}
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; |