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,21 +1,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CyclingDots({
size,
width,
height,
className,
animationDuration = 0.5,
animationDuration = 500,
color,
stroke,
fill
}: LoadingDotsProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-move.svg
const id = crypto.randomUUID().replaceAll("-", "");
const id = useId();
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"
>
@@ -24,14 +35,14 @@ export default function CyclingDots({
cy="12"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin="0;spinner_z0Or.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="0;3"
fill="freeze"
@@ -40,7 +51,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="4;12"
fill="freeze"
@@ -49,7 +60,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="12;20"
fill="freeze"
@@ -59,7 +70,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="3;0"
fill="freeze"
@@ -78,14 +89,14 @@ export default function CyclingDots({
cy="12"
r="3"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin="0;spinner_z0Or.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="4;12"
fill="freeze"
@@ -94,7 +105,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="12;20"
fill="freeze"
@@ -104,7 +115,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="3;0"
fill="freeze"
@@ -121,7 +132,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="0;3"
fill="freeze"
@@ -132,14 +143,14 @@ export default function CyclingDots({
cy="12"
r="3"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
begin="0;spinner_z0Or.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="12;20"
fill="freeze"
@@ -149,7 +160,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="3;0"
fill="freeze"
@@ -166,7 +177,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="0;3"
fill="freeze"
@@ -175,7 +186,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="4;12"
fill="freeze"
@@ -186,15 +197,15 @@ export default function CyclingDots({
cy="12"
r="3"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`fourthDotFirstAnimate_${id}`}
begin="0;spinner_z0Or.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="3;0"
fill="freeze"
@@ -211,7 +222,7 @@ export default function CyclingDots({
begin="spinner_OLMs.end"
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="0;3"
fill="freeze"
@@ -220,7 +231,7 @@ export default function CyclingDots({
begin="spinner_UHR2.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="4;12"
fill="freeze"
@@ -229,7 +240,7 @@ export default function CyclingDots({
begin="spinner_Aguh.end"
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
keySplines=".36,.6,.31,1"
values="12;20"
fill="freeze"