From fdc2d4a971d608bb230cd8aa1e602197c7775231 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Wed, 30 Jun 2021 22:46:42 +0800
Subject: ...

---
 FrontEnd/src/views/common/Spinner.tsx | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

(limited to 'FrontEnd/src/views/common/Spinner.tsx')

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 }}
+    />
+  );
 }
-- 
cgit v1.2.3

