Skip to content

Commit f0e64c3

Browse files
committed
feat: add loader
1 parent 1ba300f commit f0e64c3

File tree

5 files changed

+101
-10
lines changed

5 files changed

+101
-10
lines changed

GUI/ETVR/ETVR.code-workspace

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
"liveServer.settings.multiRootWorkspaceName": "ETVR",
4747
"[typescriptreact]": {
4848
"editor.defaultFormatter": "esbenp.prettier-vscode"
49+
},
50+
"[css]": {
51+
"editor.defaultFormatter": "vscode.css-language-features"
4952
}
5053
}
5154
}
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import './styles.css'
2+
3+
interface LoaderProps {
4+
gradient?: string
5+
gradientMid?: string
6+
gradientBot?: string
7+
width?: string
8+
height?: string
9+
}
10+
11+
const Loader = (props: LoaderProps) => {
12+
return (
13+
<div class="spinner">
14+
<svg
15+
viewBox="0 0 100 100"
16+
xmlns="http://www.w3.org/2000/svg"
17+
class="shape"
18+
preserveAspectRatio="none"
19+
style={{
20+
width: props.width || '100%',
21+
height: props.height || '100%',
22+
}}>
23+
<defs>
24+
<linearGradient id="shape-gradient" x2="0.35" y2="1">
25+
<stop offset="0%" stop-color={props.gradient || 'var(--color-stop)'} />
26+
<stop
27+
offset="30%"
28+
stop-color={props.gradientMid || 'var(--color-middle-bot)'}
29+
/>
30+
<stop offset="100%" stop-color={props.gradientBot || 'var(--color-bot)'} />
31+
</linearGradient>
32+
</defs>
33+
<g>
34+
<circle class="gradient-bg" cx="50" cy="50" r="20" />
35+
</g>
36+
</svg>
37+
</div>
38+
)
39+
}
40+
41+
export default Loader
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#shape-gradient {
2+
--color-stop: orange;
3+
--color-middle-bot: rgba(255, 153, 0, 0.594);
4+
--color-bot: rgba(255, 153, 0, 0.344);
5+
}
6+
7+
.shape {
8+
animation: rotate 4s ease-in-out infinite, dash 1.5s ease-in-out infinite;
9+
}
10+
11+
.shape .gradient-bg {
12+
stroke: url(#shape-gradient);
13+
fill: none;
14+
stroke-width: 0.25;
15+
}
16+
17+
.spinner {
18+
width: 100%;
19+
height: 100%;
20+
display: flex;
21+
justify-content: center;
22+
align-items: center;
23+
}
24+
25+
@keyframes dash {
26+
0% {
27+
stroke-dasharray: 1, 200;
28+
stroke-dashoffset: 0;
29+
}
30+
31+
50% {
32+
stroke-dasharray: 89, 200;
33+
stroke-dashoffset: -35px;
34+
}
35+
36+
100% {
37+
stroke-dasharray: 89, 200;
38+
stroke-dashoffset: -124px;
39+
}
40+
}
41+
42+
@keyframes rotate {
43+
0% {
44+
transform: rotate(-360deg);
45+
}
46+
}

GUI/ETVR/src/components/Loaders/index.tsx

-10
This file was deleted.

GUI/ETVR/src/components/Settings/index.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import CameraAddress from './CameraAddress/CameraAddress'
22
import CameraInfo from './CameraInfo/CameraInfo'
3+
import Loader from '@components/Loader'
34
import { CameraStatus, CameraType } from '@store/camera/camera'
45

56
// TODO: stuff todo requested by lorow
@@ -27,6 +28,16 @@ const Settings = (props: IProps) => {
2728
cameraType={props.cameraType}
2829
/>
2930
<CameraAddress onChange={(value) => props.onChange(value)} />
31+
<br />
32+
<div class="flex justify-center items-center">
33+
<Loader
34+
gradient="orange"
35+
gradientMid="rgba(255, 153, 0, 0.594)"
36+
gradientBot="rgba(255, 153, 0, 0.144)"
37+
width="100px"
38+
height="100px"
39+
/>
40+
</div>
3041
</div>
3142
)
3243
}

0 commit comments

Comments
 (0)