aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/components/button
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-08-31 00:30:35 +0800
committercrupest <crupest@outlook.com>2023-08-31 00:30:35 +0800
commit9c69024cf5961c3c71fb58e4237f09a513d195b1 (patch)
treee3986003da3b261f3f0f96c24166fed016ff8b48 /FrontEnd/src/components/button
parent97c3d6f302e236a273d64ddffc632f18ed967cbc (diff)
downloadtimeline-9c69024cf5961c3c71fb58e4237f09a513d195b1.tar.gz
timeline-9c69024cf5961c3c71fb58e4237f09a513d195b1.tar.bz2
timeline-9c69024cf5961c3c71fb58e4237f09a513d195b1.zip
Minor buttons
Diffstat (limited to 'FrontEnd/src/components/button')
-rw-r--r--FrontEnd/src/components/button/Button.tsx4
-rw-r--r--FrontEnd/src/components/button/ButtonRowV2.tsx14
-rw-r--r--FrontEnd/src/components/button/FlatButton.tsx4
-rw-r--r--FrontEnd/src/components/button/IconButton.tsx4
-rw-r--r--FrontEnd/src/components/button/LoadingButton.tsx4
5 files changed, 16 insertions, 14 deletions
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<HTMLButtonElement> | 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({
<Button
{...commonProps}
text={text}
- outline={outline ?? realAction !== "primary"}
+ outline={outline ?? realAction !== "major"}
{...props}
className={newClassName}
/>
diff --git a/FrontEnd/src/components/button/FlatButton.tsx b/FrontEnd/src/components/button/FlatButton.tsx
index 9f074dd6..aad02e76 100644
--- a/FrontEnd/src/components/button/FlatButton.tsx
+++ b/FrontEnd/src/components/button/FlatButton.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 "./FlatButton.css";
interface FlatButtonProps extends ComponentPropsWithoutRef<"button"> {
- color?: ThemeColor;
+ color?: ClickableColor;
text?: Text;
buttonRef?: Ref<HTMLButtonElement> | null;
}
diff --git a/FrontEnd/src/components/button/IconButton.tsx b/FrontEnd/src/components/button/IconButton.tsx
index 95c58887..e0862167 100644
--- a/FrontEnd/src/components/button/IconButton.tsx
+++ b/FrontEnd/src/components/button/IconButton.tsx
@@ -1,13 +1,13 @@
import { ComponentPropsWithoutRef } from "react";
import classNames from "classnames";
-import { ThemeColor } from "../common";
+import { ClickableColor } from "../common";
import "./IconButton.css";
interface IconButtonProps extends ComponentPropsWithoutRef<"i"> {
icon: string;
- color?: ThemeColor | "grayscale";
+ color?: ClickableColor;
large?: boolean;
disabled?: boolean; // TODO: Not implemented
}
diff --git a/FrontEnd/src/components/button/LoadingButton.tsx b/FrontEnd/src/components/button/LoadingButton.tsx
index d9d41ddb..9d65a2b3 100644
--- a/FrontEnd/src/components/button/LoadingButton.tsx
+++ b/FrontEnd/src/components/button/LoadingButton.tsx
@@ -1,12 +1,12 @@
import classNames from "classnames";
-import { I18nText, ThemeColor, useC } from "../common";
+import { I18nText, ClickableColor, useC } from "../common";
import Spinner from "../Spinner";
import "./LoadingButton.css";
interface LoadingButtonProps extends React.ComponentPropsWithoutRef<"button"> {
- color?: ThemeColor;
+ color?: ClickableColor;
text?: I18nText;
loading?: boolean;
}