Update loading components
This commit is contained in:
@@ -1,19 +1,30 @@
|
||||
import type { LoadingDotsProps } from "$/types/LoadingTypes";
|
||||
import { usePrefersReducedMotion } from "$/util/AccessibilityUtil";
|
||||
|
||||
|
||||
export default function CircleFadingDots({
|
||||
size,
|
||||
width,
|
||||
height,
|
||||
className,
|
||||
animationDuration = 0.75,
|
||||
animationDuration = 750,
|
||||
color,
|
||||
stroke,
|
||||
fill
|
||||
}: LoadingDotsProps){
|
||||
fill,
|
||||
ariaLabel = "Loading"
|
||||
}: Readonly<LoadingDotsProps>){
|
||||
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/6-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"
|
||||
>
|
||||
@@ -24,8 +35,8 @@ export default function CircleFadingDots({
|
||||
r="1.5"
|
||||
opacity=".14"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<circle
|
||||
cx="16.75"
|
||||
@@ -33,8 +44,8 @@ export default function CircleFadingDots({
|
||||
r="1.5"
|
||||
opacity=".29"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<circle
|
||||
cx="20.23"
|
||||
@@ -42,8 +53,8 @@ export default function CircleFadingDots({
|
||||
r="1.5"
|
||||
opacity=".43"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<circle
|
||||
cx="21.50"
|
||||
@@ -51,8 +62,8 @@ export default function CircleFadingDots({
|
||||
r="1.5"
|
||||
opacity=".57"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<circle
|
||||
cx="20.23"
|
||||
@@ -60,8 +71,8 @@ export default function CircleFadingDots({
|
||||
r="1.5"
|
||||
opacity=".71"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<circle
|
||||
cx="16.75"
|
||||
@@ -69,22 +80,22 @@ export default function CircleFadingDots({
|
||||
r="1.5"
|
||||
opacity=".86"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<circle
|
||||
cx="12"
|
||||
cy="21.5"
|
||||
r="1.5"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
stroke={color ?? stroke}
|
||||
fill={color ?? fill}
|
||||
/>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
calcMode="discrete"
|
||||
dur={animationDuration}
|
||||
dur={dur}
|
||||
values="0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user