From f5dfd52f6efece2f4cad227044ecf4dd66301bbc Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 26 Aug 2023 21:36:58 +0800 Subject: ... --- FrontEnd/src/components/button/Button.tsx | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 FrontEnd/src/components/button/Button.tsx (limited to 'FrontEnd/src/components/button/Button.tsx') diff --git a/FrontEnd/src/components/button/Button.tsx b/FrontEnd/src/components/button/Button.tsx new file mode 100644 index 00000000..6c38e130 --- /dev/null +++ b/FrontEnd/src/components/button/Button.tsx @@ -0,0 +1,46 @@ +import { ComponentPropsWithoutRef, Ref } from "react"; +import classNames from "classnames"; + +import { Text, useC, ThemeColor } from "../common"; + +import "./Button.css"; + +interface ButtonProps extends ComponentPropsWithoutRef<"button"> { + color?: ThemeColor; + text?: Text; + outline?: boolean; + buttonRef?: Ref | null; +} + +export default function Button(props: ButtonProps) { + const { + buttonRef, + color, + text, + outline, + className, + children, + ...otherProps + } = props; + + if (text != null && children != null) { + console.warn("You can't set both text and children props."); + } + + const c = useC(); + + return ( + + ); +} -- cgit v1.2.3 From 9c69024cf5961c3c71fb58e4237f09a513d195b1 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 31 Aug 2023 00:30:35 +0800 Subject: Minor buttons --- FrontEnd/src/components/button/Button.tsx | 4 +-- FrontEnd/src/components/button/ButtonRowV2.tsx | 14 ++++---- FrontEnd/src/components/button/FlatButton.tsx | 4 +-- FrontEnd/src/components/button/IconButton.tsx | 4 +-- FrontEnd/src/components/button/LoadingButton.tsx | 4 +-- FrontEnd/src/components/common.ts | 2 ++ FrontEnd/src/components/dialog/FullPageDialog.tsx | 4 +-- FrontEnd/src/components/dialog/OperationDialog.tsx | 39 +++++++++------------- FrontEnd/src/components/index.css | 2 +- FrontEnd/src/components/theme.css | 23 ++++++++++--- FrontEnd/src/pages/setting/index.css | 4 +-- FrontEnd/src/pages/timeline/TimelineCard.css | 4 +-- .../src/pages/timeline/TimelinePostCreateView.css | 4 +-- 13 files changed, 62 insertions(+), 50 deletions(-) (limited to 'FrontEnd/src/components/button/Button.tsx') diff --git a/FrontEnd/src/components/button/Button.tsx b/FrontEnd/src/components/button/Button.tsx index 6c38e130..30ea8c11 100644 --- a/FrontEnd/src/components/button/Button.tsx +++ b/FrontEnd/src/components/button/Button.tsx @@ -1,12 +1,12 @@ import { ComponentPropsWithoutRef, Ref } from "react"; import classNames from "classnames"; -import { Text, useC, ThemeColor } from "../common"; +import { Text, useC, ClickableColor } from "../common"; import "./Button.css"; interface ButtonProps extends ComponentPropsWithoutRef<"button"> { - color?: ThemeColor; + color?: ClickableColor; text?: Text; outline?: boolean; buttonRef?: Ref | null; diff --git a/FrontEnd/src/components/button/ButtonRowV2.tsx b/FrontEnd/src/components/button/ButtonRowV2.tsx index 5129e7f1..a54425cc 100644 --- a/FrontEnd/src/components/button/ButtonRowV2.tsx +++ b/FrontEnd/src/components/button/ButtonRowV2.tsx @@ -1,7 +1,7 @@ import { ComponentPropsWithoutRef, Ref } from "react"; import classNames from "classnames"; -import { Text, ThemeColor } from "../common"; +import { Text, ClickableColor } from "../common"; import Button from "./Button"; import FlatButton from "./FlatButton"; @@ -10,10 +10,12 @@ import LoadingButton from "./LoadingButton"; import "./ButtonRow.css"; +type ButtonAction = "major" | "minor"; + interface ButtonRowV2ButtonBase { key: string | number; - action?: "primary" | "secondary"; - color?: ThemeColor; + action?: ButtonAction; + color?: ClickableColor; disabled?: boolean; onClick?: () => void; } @@ -76,9 +78,9 @@ export default function ButtonRowV2({ {buttons.map((button) => { const { key, action, color, disabled, onClick } = button; - const realAction = action ?? "primary"; + const realAction: ButtonAction = action ?? "minor"; const realColor = - color ?? (realAction === "primary" ? "primary" : "secondary"); + color ?? (realAction === "major" ? "primary" : "minor"); const commonProps = { key, color: realColor, disabled, onClick }; const newClassName = classNames( @@ -95,7 +97,7 @@ export default function ButtonRowV2({