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,32 @@
import type { LoadingDotsProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function CircleCenterDots({
size,
width,
height,
className,
animationDuration = 0.6,
animationDuration = 600,
color,
stroke,
fill
}: LoadingDotsProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingDotsProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-dots-scale-middle.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"
>
@@ -25,15 +35,15 @@ export default function CircleCenterDots({
cy="3"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle1_${id}`}
begin={`0;circle3_${id}.end-${animationDuration * 5 / 6}s`}
begin={`0;circle3_${id}.end-${dur * 5 / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -43,15 +53,15 @@ export default function CircleCenterDots({
cy="4.21"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle2_${id}`}
begin={`circle1_${id}.begin+${animationDuration / 6}s`}
begin={`circle1_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -61,15 +71,15 @@ export default function CircleCenterDots({
cy="4.21"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle3_${id}`}
begin={`circle5_${id}.begin+${animationDuration / 6}s`}
begin={`circle5_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -79,15 +89,15 @@ export default function CircleCenterDots({
cy="7.50"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle4_${id}`}
begin={`circle2_${id}.begin+${animationDuration / 6}s`}
begin={`circle2_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -97,15 +107,15 @@ export default function CircleCenterDots({
cy="7.50"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle5_${id}`}
begin={`circle7_${id}.begin+${animationDuration / 6}s`}
begin={`circle7_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -115,14 +125,14 @@ export default function CircleCenterDots({
cy="12.00"
r="0"
className={className}
stroke={stroke}
stroke={color ?? stroke}
>
<animate
id={`circle6_${id}`}
begin={`circle4_${id}.begin+${animationDuration / 6}s`}
begin={`circle4_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -132,15 +142,15 @@ export default function CircleCenterDots({
cy="12.00"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle7_${id}`}
begin={`circle9_${id}.begin+${animationDuration / 6}s`}
begin={`circle9_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -150,15 +160,15 @@ export default function CircleCenterDots({
cy="16.50"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle8_${id}`}
begin={`circle6_${id}.begin+${animationDuration / 6}s`}
begin={`circle6_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -168,15 +178,15 @@ export default function CircleCenterDots({
cy="16.50"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle9_${id}`}
begin={`circle11_${id}.begin+${animationDuration / 6}s`}
begin={`circle11_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -186,15 +196,15 @@ export default function CircleCenterDots({
cy="19.79"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle10_${id}`}
begin={`circle8_${id}.begin+${animationDuration / 6}s`}
begin={`circle8_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -204,15 +214,15 @@ export default function CircleCenterDots({
cy="19.79"
r="0"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
id={`circle11_${id}`}
begin={`circle12_${id}.begin+${animationDuration / 6}s`}
begin={`circle12_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>
@@ -221,16 +231,16 @@ export default function CircleCenterDots({
cx="12"
cy="21"
r="0"
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
className={className}
>
<animate
id={`circle12_${id}`}
begin={`circle10_${id}.begin+${animationDuration / 6}s`}
begin={`circle10_${id}.begin+${dur / 6}s`}
attributeName="r"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="0;2;0"
keySplines=".27,.42,.37,.99;.53,0,.61,.73"
/>