diff options
Diffstat (limited to 'FrontEnd')
-rw-r--r-- | FrontEnd/src/components/ImageCropper.css | 3 | ||||
-rw-r--r-- | FrontEnd/src/components/Spinner.tsx | 52 |
2 files changed, 32 insertions, 23 deletions
diff --git a/FrontEnd/src/components/ImageCropper.css b/FrontEnd/src/components/ImageCropper.css index 9631cf1d..03d2038f 100644 --- a/FrontEnd/src/components/ImageCropper.css +++ b/FrontEnd/src/components/ImageCropper.css @@ -1,12 +1,11 @@ .cru-image-cropper-container {
position: relative;
box-sizing: border-box;
+ display: flex;
user-select: none;
}
.cru-image-cropper-container img {
- left: 0;
- top: 0;
width: 100%;
height: 100%;
}
diff --git a/FrontEnd/src/components/Spinner.tsx b/FrontEnd/src/components/Spinner.tsx index ec0c2c35..2752a519 100644 --- a/FrontEnd/src/components/Spinner.tsx +++ b/FrontEnd/src/components/Spinner.tsx @@ -1,36 +1,46 @@ -import { CSSProperties } from "react"; -import classnames from "classnames"; - -import { ThemeColor } from "./common"; +import { CSSProperties, ComponentPropsWithoutRef } from "react"; +import classNames from "classnames"; import "./Spinner.css"; -export interface SpinnerProps { +const sizeMap: Record<string, string> = { + sm: "18px", + md: "30px", + lg: "42px", +}; + +function calculateSize(size: SpinnerProps["size"]) { + if (size == null) { + return "1em"; + } + if (typeof size === "number") { + return size; + } + if (size in sizeMap) { + return sizeMap[size]; + } + return size; +} + +export interface SpinnerProps extends ComponentPropsWithoutRef<"span"> { size?: "sm" | "md" | "lg" | number | string; - color?: ThemeColor; className?: string; style?: CSSProperties; } export default function Spinner(props: SpinnerProps) { - const { size, color, className, style } = props; - const calculatedSize = - size === "sm" - ? "18px" - : size === "md" - ? "30px" - : size === "lg" - ? "42px" - : typeof size === "number" - ? size - : size == null - ? "20px" - : size; + const { size, className, style, ...otherProps } = props; + const calculatedSize = calculateSize(size); return ( <span - className={classnames("cru-spinner", color && `cru-${color}`, className)} - style={{ width: calculatedSize, height: calculatedSize, ...style }} + className={classNames("cru-spinner", className)} + style={{ + width: calculatedSize, + height: calculatedSize, + ...style, + }} + {...otherProps} /> ); } |