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,23 +1,35 @@
import type { RubberLoadingSpinnerProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
export default function RubberSpinner({
size,
width,
height,
animationDuration = 2,
stretchDuration = 1.5,
animationDuration = 2000,
stretchDuration = 1500,
color,
className,
stroke,
fill = "none",
trackClassName = "fill-transparent",
trackStroke,
trackFill
}: RubberLoadingSpinnerProps){
trackFill,
ariaLabel = "Loading"
}: Readonly<RubberLoadingSpinnerProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/ring-resize.svg
const reducedMotion = usePrefersReducedMotion();
const animationDur = reducedMotion ? animationDuration / 100 : animationDuration / 1000;
const stretchDur = reducedMotion ? stretchDuration / 100 : stretchDuration / 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"
>
@@ -33,14 +45,14 @@ export default function RubberSpinner({
cy="12"
r="9.5"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
strokeWidth="3"
strokeLinecap="round"
>
<animate
attributeName="stroke-dasharray"
dur={stretchDuration}
dur={stretchDur}
calcMode="spline"
values="0 150;42 150;42 150;42 150"
keyTimes="0;0.475;0.95;1"
@@ -49,7 +61,7 @@ export default function RubberSpinner({
/>
<animate
attributeName="stroke-dashoffset"
dur={stretchDuration}
dur={stretchDur}
calcMode="spline"
values="0;-16;-59;-59"
keyTimes="0;0.475;0.95;1"
@@ -60,7 +72,7 @@ export default function RubberSpinner({
<animateTransform
attributeName="transform"
type="rotate"
dur={animationDuration}
dur={animationDur}
values="0 12 12;360 12 12"
repeatCount="indefinite"
/>