mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 21:53:57 -05:00
Most simple components created
This commit is contained in:
79
lib/component/loading/dot/FadingDots.tsx
Normal file
79
lib/component/loading/dot/FadingDots.tsx
Normal file
@@ -0,0 +1,79 @@
|
||||
import type { LoadingDotsProps } from "$/types/Loading";
|
||||
|
||||
|
||||
export default function FadingDots({
|
||||
width,
|
||||
height,
|
||||
className,
|
||||
animationDuration = 0.75,
|
||||
stroke,
|
||||
fill
|
||||
}: LoadingDotsProps){
|
||||
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-fade.svg
|
||||
const id = crypto.randomUUID().replaceAll("-", "");
|
||||
|
||||
|
||||
return (
|
||||
<svg
|
||||
width={width}
|
||||
height={height}
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<circle
|
||||
cx="4"
|
||||
cy="12"
|
||||
r="3"
|
||||
opacity="1"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
>
|
||||
<animate
|
||||
id={`firstFadingDots_${id}`}
|
||||
begin={`0;lastFadingDots_${id}.end-${animationDuration / 3}s`}
|
||||
attributeName="opacity"
|
||||
dur={animationDuration}
|
||||
values="1;.2"
|
||||
fill="freeze"
|
||||
/>
|
||||
</circle>
|
||||
<circle
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="3"
|
||||
opacity=".4"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
>
|
||||
<animate
|
||||
id={`secondFadingDots_${id}`}
|
||||
begin={`firstFadingDots_${id}.begin+${animationDuration / 5}s`}
|
||||
attributeName="opacity"
|
||||
dur={animationDuration}
|
||||
values="1;.2"
|
||||
fill="freeze"
|
||||
/>
|
||||
</circle>
|
||||
<circle
|
||||
cx="20"
|
||||
cy="12"
|
||||
r="3"
|
||||
opacity=".3"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
fill={fill}
|
||||
>
|
||||
<animate
|
||||
id={`lastFadingDots_${id}`}
|
||||
begin={`secondFadingDots_${id}.begin+${animationDuration / 5}s`}
|
||||
attributeName="opacity"
|
||||
dur={animationDuration}
|
||||
values="1;.2"
|
||||
fill="freeze"
|
||||
/>
|
||||
</circle>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user