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 { LoadingVariousProps } from "$/types/LoadingTypes";
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
import { useId } from "react";
export default function SpinningBinary({
size,
width,
height,
className,
animationDuration = 2,
animationDuration = 2000,
color,
stroke,
fill
}: LoadingVariousProps){
fill,
ariaLabel = "Loading"
}: Readonly<LoadingVariousProps>){
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/gooey-balls-2.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"
>
@@ -49,13 +59,13 @@ export default function SpinningBinary({
cy="12"
r="4"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="5;8;5"
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
repeatCount="indefinite"
@@ -66,13 +76,13 @@ export default function SpinningBinary({
cy="12"
r="4"
className={className}
stroke={stroke}
fill={fill}
stroke={color ?? stroke}
fill={color ?? fill}
>
<animate
attributeName="cx"
calcMode="spline"
dur={animationDuration}
dur={dur}
values="19;16;19"
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
repeatCount="indefinite"
@@ -81,7 +91,7 @@ export default function SpinningBinary({
<animateTransform
attributeName="transform"
type="rotate"
dur={animationDuration * 3 / 8}
dur={dur * 3 / 8}
values="0 12 12;360 12 12"
repeatCount="indefinite"
/>