aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/common/Spinner.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-30 22:46:42 +0800
committercrupest <crupest@outlook.com>2021-06-30 22:46:42 +0800
commitfdc2d4a971d608bb230cd8aa1e602197c7775231 (patch)
treed14c60fd52750308edd8b06d8f207a526c360f1a /FrontEnd/src/views/common/Spinner.tsx
parenta1c593ee087c47937f98dee4459c8d50fdd7b9d7 (diff)
downloadtimeline-fdc2d4a971d608bb230cd8aa1e602197c7775231.tar.gz
timeline-fdc2d4a971d608bb230cd8aa1e602197c7775231.tar.bz2
timeline-fdc2d4a971d608bb230cd8aa1e602197c7775231.zip
...
Diffstat (limited to 'FrontEnd/src/views/common/Spinner.tsx')
-rw-r--r--FrontEnd/src/views/common/Spinner.tsx30
1 files changed, 27 insertions, 3 deletions
diff --git a/FrontEnd/src/views/common/Spinner.tsx b/FrontEnd/src/views/common/Spinner.tsx
index 783c9be2..b591d8ab 100644
--- a/FrontEnd/src/views/common/Spinner.tsx
+++ b/FrontEnd/src/views/common/Spinner.tsx
@@ -1,13 +1,37 @@
-import { PaletteColorType } from "@/palette";
import React from "react";
+import classnames from "classnames";
+
+import { PaletteColorType } from "@/palette";
+
+import "./Spinner.css";
export interface SpinnerProps {
- size?: "sm" | "md" | "lg" | number;
+ size?: "sm" | "md" | "lg" | number | string;
color?: PaletteColorType;
}
export default function Spinner(
props: SpinnerProps
): React.ReactElement | null {
- return <span />;
+ const { size, color } = props;
+ const calculatedSize =
+ size === "sm"
+ ? "18px"
+ : size === "md"
+ ? "30px"
+ : size === "lg"
+ ? "42px"
+ : typeof size === "number"
+ ? size
+ : size == null
+ ? "20px"
+ : size;
+ const calculatedColor = color ?? "primary";
+
+ return (
+ <span
+ className={classnames("cru-spinner", `cru-color-${calculatedColor}`)}
+ style={{ width: calculatedSize, height: calculatedSize }}
+ />
+ );
}