mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-07 14:13:58 -05:00
71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import type { RubberLoadingSpinnerProps } from "$/types/Loading";
|
|
|
|
|
|
export default function RubberSpinner({
|
|
width,
|
|
height,
|
|
animationDuration = 2,
|
|
stretchDuration = 1.5,
|
|
className,
|
|
stroke,
|
|
fill = "none",
|
|
trackClassName = "fill-transparent",
|
|
trackStroke,
|
|
trackFill
|
|
}: RubberLoadingSpinnerProps){
|
|
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/ring-resize.svg
|
|
return (
|
|
<svg
|
|
width={width}
|
|
height={height}
|
|
viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path
|
|
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"
|
|
className={trackClassName}
|
|
stroke={trackStroke}
|
|
fill={trackFill}
|
|
/>
|
|
<g>
|
|
<circle
|
|
cx="12"
|
|
cy="12"
|
|
r="9.5"
|
|
className={className}
|
|
stroke={stroke}
|
|
fill={fill}
|
|
stroke-width="3"
|
|
stroke-linecap="round"
|
|
>
|
|
<animate
|
|
attributeName="stroke-dasharray"
|
|
dur={stretchDuration}
|
|
calcMode="spline"
|
|
values="0 150;42 150;42 150;42 150"
|
|
keyTimes="0;0.475;0.95;1"
|
|
keySplines="0.42,0,0.58,1;0.42,0,0.58,1;0.42,0,0.58,1"
|
|
repeatCount="indefinite"
|
|
/>
|
|
<animate
|
|
attributeName="stroke-dashoffset"
|
|
dur={stretchDuration}
|
|
calcMode="spline"
|
|
values="0;-16;-59;-59"
|
|
keyTimes="0;0.475;0.95;1"
|
|
keySplines="0.42,0,0.58,1;0.42,0,0.58,1;0.42,0,0.58,1"
|
|
repeatCount="indefinite"
|
|
/>
|
|
</circle>
|
|
<animateTransform
|
|
attributeName="transform"
|
|
type="rotate"
|
|
dur={animationDuration}
|
|
values="0 12 12;360 12 12"
|
|
repeatCount="indefinite"
|
|
/>
|
|
</g>
|
|
</svg>
|
|
);
|
|
}
|