Skip to content

Commit a4f8ad6

Browse files
author
Agney
committed
introduce ball triangle
1 parent 2741d9d commit a4f8ad6

File tree

3 files changed

+87
-3
lines changed

3 files changed

+87
-3
lines changed

example/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import 'react-app-polyfill/ie11';
22
import * as React from 'react';
33
import * as ReactDOM from 'react-dom';
4-
import { useLoading, Audio } from '../.';
4+
import { useLoading, BallTriangle } from '../.';
55

66
const App = () => {
77
const { containerProps, indicatorEl } = useLoading({
8-
indicator: <Audio />,
8+
indicator: <BallTriangle />,
99
loading: true,
1010
});
1111
return (

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { useLoading } from './useLoading';
22

33
// Loaders
4-
export { Audio } from './loaders/Audio';
4+
export { Audio } from './loaders/Audio';
5+
export { BallTriangle } from './loaders/BallTriangle';

src/loaders/BallTriangle.tsx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import React from "react";
2+
3+
interface Props {
4+
height?: string | number;
5+
width?: string | number;
6+
color?: string;
7+
radius?: number;
8+
}
9+
10+
export const BallTriangle = ({ height, width, color = 'currentColor', radius = 5 }: Props) => (
11+
<svg
12+
height={height}
13+
width={width}
14+
stroke={color}
15+
viewBox="0 0 57 57"
16+
xmlns="http://www.w3.org/2000/svg"
17+
>
18+
<g fill="none" fillRule="evenodd">
19+
<g transform="translate(1 1)" strokeWidth="2">
20+
<circle cx="5" cy="50" r={radius}>
21+
<animate
22+
attributeName="cy"
23+
begin="0s"
24+
dur="2.2s"
25+
values="50;5;50;50"
26+
calcMode="linear"
27+
repeatCount="indefinite"
28+
/>
29+
<animate
30+
attributeName="cx"
31+
begin="0s"
32+
dur="2.2s"
33+
values="5;27;49;5"
34+
calcMode="linear"
35+
repeatCount="indefinite"
36+
/>
37+
</circle>
38+
<circle cx="27" cy="5" r={radius}>
39+
<animate
40+
attributeName="cy"
41+
begin="0s"
42+
dur="2.2s"
43+
from="5"
44+
to="5"
45+
values="5;50;50;5"
46+
calcMode="linear"
47+
repeatCount="indefinite"
48+
/>
49+
<animate
50+
attributeName="cx"
51+
begin="0s"
52+
dur="2.2s"
53+
from="27"
54+
to="27"
55+
values="27;49;5;27"
56+
calcMode="linear"
57+
repeatCount="indefinite"
58+
/>
59+
</circle>
60+
<circle cx="49" cy="50" r={radius}>
61+
<animate
62+
attributeName="cy"
63+
begin="0s"
64+
dur="2.2s"
65+
values="50;50;5;50"
66+
calcMode="linear"
67+
repeatCount="indefinite"
68+
/>
69+
<animate
70+
attributeName="cx"
71+
from="49"
72+
to="49"
73+
begin="0s"
74+
dur="2.2s"
75+
values="49;5;27;49"
76+
calcMode="linear"
77+
repeatCount="indefinite"
78+
/>
79+
</circle>
80+
</g>
81+
</g>
82+
</svg>
83+
);

0 commit comments

Comments
 (0)