Update loading components

This commit is contained in:
2026-02-24 22:16:46 -05:00
parent a61e7ce19a
commit 637b3a0c34
43 changed files with 1363 additions and 930 deletions

View File

@@ -1,22 +1,33 @@
import type { LoadingSpinnerProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function HalfSpinner({
size,
width,
height,
animationDuration = 1,
animationDuration = 1000,
color,
className,
stroke,
fill,
trackClassName = "fill-transparent",
trackStroke,
trackFill
}: LoadingSpinnerProps){
trackFill,
ariaLabel = "Loading"
}: Readonly<LoadingSpinnerProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/180-ring-with-bg.svg
const reducedMotion = usePrefersReducedMotion();
const dur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
return (
<svg
width={width}
height={height}
width={size ?? width}
height={size ?? height}
role="status"
aria-live="polite"
aria-label={ariaLabel}
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
@@ -29,13 +40,13 @@ export default function HalfSpinner({
<path
d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animateTransform
attributeName="transform"
type="rotate"
dur={animationDuration}
dur={dur}
values="0 12 12;360 12 12"
repeatCount="indefinite"
/>