Update loading components
This commit is contained in:
@@ -1,18 +1,29 @@
|
||||
import type { LoadingDotsProps } from "$/types/LoadingTypes";
|
||||
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
|
||||
|
||||
export default function RotatingDots({
|
||||
size,
|
||||
width,
|
||||
height,
|
||||
className,
|
||||
animationDuration = 1,
|
||||
animationDuration = 1000,
|
||||
color,
|
||||
stroke,
|
||||
fill
|
||||
}: LoadingDotsProps){
|
||||
fill,
|
||||
ariaLabel = "Loading"
|
||||
}: Readonly<LoadingDotsProps>){
|
||||
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-rotate.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"
|
||||
>
|
||||
@@ -21,8 +32,8 @@ export default function RotatingDots({
|
||||
cy="12"
|
||||
r="3"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<g>
|
||||
<circle
|
||||
@@ -30,22 +41,22 @@ export default function RotatingDots({
|
||||
cy="12"
|
||||
r="3"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<circle
|
||||
cx="20"
|
||||
cy="12"
|
||||
r="3"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
calcMode="spline"
|
||||
dur={animationDuration}
|
||||
dur={dur}
|
||||
keySplines=".36,.6,.31,1;.36,.6,.31,1"
|
||||
values="0 12 12;180 12 12;360 12 12"
|
||||
repeatCount="indefinite"
|
||||
|
||||
Reference in New Issue
Block a user