import type { LoadingDotsProps } from "$/types/Loading";

export default function RotatingDots({
	width,
	height,
	className,
	animationDuration = 1,
	stroke,
	fill
}: LoadingDotsProps){
	//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-rotate.svg
	return (
		<svg
			width={width}
			height={height}
			viewBox="0 0 24 24"
			xmlns="http://www.w3.org/2000/svg"
		>
			<circle
				cx="12"
				cy="12"
				r="3"
				className={className}
				stroke={stroke}
				fill={fill}
			/>
			<g>
				<circle
					cx="4"
					cy="12"
					r="3"
					className={className}
					stroke={stroke}
					fill={fill}
				/>
				<circle
					cx="20"
					cy="12"
					r="3"
					className={className}
					stroke={stroke}
					fill={fill}
				/>
				<animateTransform
					attributeName="transform"
					type="rotate"
					calcMode="spline"
					dur={animationDuration}
					keySplines=".36,.6,.31,1;.36,.6,.31,1"
					values="0 12 12;180 12 12;360 12 12"
					repeatCount="indefinite"
				/>
			</g>
		</svg>
	);
}
