From a90f1a5041cf4a622f41f3b2680052e3a4d5ba11 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 4 May 2022 11:35:47 +0800 Subject: ... --- FrontEnd/src/views/common/button/Button.tsx | 36 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'FrontEnd/src/views/common/button/Button.tsx') diff --git a/FrontEnd/src/views/common/button/Button.tsx b/FrontEnd/src/views/common/button/Button.tsx index a39ef8a7..1e4163ff 100644 --- a/FrontEnd/src/views/common/button/Button.tsx +++ b/FrontEnd/src/views/common/button/Button.tsx @@ -1,30 +1,40 @@ import React from "react"; +import classNames from "classnames"; import { useTranslation } from "react-i18next"; -import { calculateProps, CommonButtonProps } from "./common"; +import { convertI18nText, I18nText } from "@/common"; +import { PaletteColorType } from "@/palette"; import "./Button.css"; function _Button( - props: CommonButtonProps & { + props: { + color?: PaletteColorType; + text?: I18nText; outline?: boolean; - customButtonClassName?: string; - }, + } & React.ComponentPropsWithoutRef<"button">, ref: React.ForwardedRef -): React.ReactElement | null { +): JSX.Element { const { t } = useTranslation(); - const { customButtonClassName, outline, ...otherProps } = props; + const { color, text, outline, className, children, ...otherProps } = props; - const { newProps, children } = calculateProps( - otherProps, - customButtonClassName ?? "cru-button" + (outline ? " outline" : ""), - t - ); + if (text != null && children != null) { + console.warn("You can't set both text and children props."); + } return ( - ); } -- cgit v1.2.3