Skip to content

Commit 16df6f2

Browse files
authored
Size (#7)
* fixed the size of loading icon * add header and height constraint * updated version * spinner size fixed
1 parent 7c9b9fe commit 16df6f2

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

example/src/modules/ImageCrush.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ const ImageCrush = ({
8787

8888
if (!image) {
8989
return (
90-
<>{!hideSpinner && <Spinner icon={spinnerIcon} color={spinnerColor} />}</>
90+
<>{!hideSpinner && <Spinner width={width}
91+
height={height} icon={spinnerIcon} color={spinnerColor} />}</>
9192
);
9293
}
9394

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import React from "react";
22
import "./styles.css";
33

4-
export const Spinner = ({icon:Icon, backgroundColor = 'gray'}) => {
4+
export const Spinner = ({
5+
icon: Icon,
6+
backgroundColor = "gray",
7+
width,
8+
height,
9+
}) => {
510
if (Icon) return Icon;
611
return (
712
<>
8-
<style>
9-
{`
13+
<style>
14+
{`
1015
.assetcrush-lds-roller div:after {
1116
content: " ";
1217
display: block;
@@ -18,17 +23,30 @@ export const Spinner = ({icon:Icon, backgroundColor = 'gray'}) => {
1823
margin: -4px 0 0 -4px;
1924
}
2025
`}
21-
</style>
22-
<div className="assetcrush-lds-roller">
23-
<div></div>
24-
<div></div>
25-
<div></div>
26-
<div></div>
27-
<div></div>
28-
<div></div>
29-
<div></div>
30-
<div></div>
31-
</div>
26+
</style>
27+
<div
28+
style={{
29+
transform: `${
30+
width < height
31+
? `scale(${height > 100 ? 1 : height / 300},${
32+
height > 100 ? 1 : height / 300
33+
})`
34+
: `scale(${width > 100 ? 1 : width / 300},${
35+
width > 100 ? 1 : width / 300
36+
})`
37+
}`,
38+
}}
39+
className="assetcrush-lds-roller"
40+
>
41+
<div></div>
42+
<div></div>
43+
<div></div>
44+
<div></div>
45+
<div></div>
46+
<div></div>
47+
<div></div>
48+
<div></div>
49+
</div>
3250
</>
3351
);
3452
};

0 commit comments

Comments
 (0)