Skip to content

Commit f079864

Browse files
committed
Update styles to render properly upon use, use Text hook, mod global css styles
1 parent 00c2940 commit f079864

File tree

13 files changed

+74
-67
lines changed

13 files changed

+74
-67
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
- Fix text display on `FourSquare` loader.
4949
- Remove duplicated `d-i-b` css class and add `rli-d-i-b` as a global style.
5050

51-
# --next-version-
51+
# 0.1.0
5252

53-
- Add new indicator `GlidingBlink`.
53+
- New indicators `GlidingBlink`, `Twist`, `Pulse` & `Slab`.
5454
- Centralize default _vars_.
5555
- Fine tune `Atom` and `Commet` indicators.
5656
- Code refactor.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-loading-indicators",
3-
"version": "0.0.11",
4-
"description": "A collection of loading indicators for your application",
3+
"version": "0.1.0",
4+
"description": "Simply elegant light-weight loading indicators for react applications",
55
"scripts": {
66
"prebuild": "rm -rf dist",
77
"build": "rollup -c",

rollup.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export default [
2525
}
2626
],
2727
plugins: [
28-
peerDepsExternal(),
29-
resolve(),
30-
commonjs(),
31-
typescript({ tsconfig: "./tsconfig.json" }),
32-
postcss({ plugins: [autoprefixer] }),
33-
terser()
28+
peerDepsExternal(), // Prevents Rollup from bundling the peer dependencies we've defined in package.json (react and react-dom)
29+
resolve(), // Efficiently bundles third party dependencies we've installed and use in node_modules
30+
commonjs(), // Enables transpilation into CommonJS (CJS) format
31+
typescript({ tsconfig: "./tsconfig.json" }), // Transpiles our TypeScript code into JavaScript
32+
postcss({ plugins: [autoprefixer] }), // Transforms our Sass -> into CSS -> into JS tokens; for injection in style tags of HTML
33+
terser() // Minify the Rollup bundle
3434
]
3535
},
3636
{

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import "./scss_globals/global.scss";
1+
import "./scss/global.scss";
22
export * from "./indicators";
33
export { default } from "./indicators";

src/indicators/Atom/Atom.scss

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
$defaultColorRedChannel: color.red(defaults.$defaultColor);
55
$defaultColorGreenChannel: color.green(defaults.$defaultColor);
66
$defaultColorBlueChannel: color.blue(defaults.$defaultColor);
7-
$spinAtomDuration: 2.5s;
7+
$spinAtomDuration: 2.1s;
88
$spinAtomPathDuration: 8s;
9-
$colorInversionDegree: 255; // 0 - 255
9+
$colorInversionDegree: 200; // 0 - 255
1010

1111
.atom-bounding-box {
1212
--color-r: #{$defaultColorRedChannel};
@@ -16,13 +16,14 @@ $colorInversionDegree: 255; // 0 - 255
1616
font-size: defaults.$fontSizer;
1717
position: relative;
1818
color: rgb(var(--color-r), var(--color-g), var(--color-b));
19+
text-align: unset;
1920

2021
// Create stacking context
2122
isolation: isolate;
2223

2324
.atom-loader {
24-
$box-width: 4em;
25-
$box-height: 4em;
25+
$box-width: 5em;
26+
$box-height: 5em;
2627

2728
// create stacking context + relative positioning
2829
position: relative;
@@ -32,7 +33,6 @@ $colorInversionDegree: 255; // 0 - 255
3233
height: $box-height;
3334
transform: perspective(500px) rotateX(-24deg) rotateY(20deg) rotateZ(30deg);
3435
transform-style: preserve-3d;
35-
// color: $defaultColor;
3636

3737
& .inner {
3838
width: 100%;
@@ -57,19 +57,24 @@ $colorInversionDegree: 255; // 0 - 255
5757
animation: rotateDisc3 $spinAtomPathDuration linear infinite;
5858
}
5959

60+
$disc-border-width: 0.3em;
6061
& .disc {
6162
position: absolute;
62-
width: 100%;
63-
height: 98%;
63+
// width: 100%;
64+
// height: 98%;
6465
border-radius: 50%;
65-
border: 0.3em solid var(--disc-color, currentColor);
66+
border: $disc-border-width solid var(--disc-color, currentColor);
6667
display: inline-block;
68+
top: 0;
69+
left: 0;
70+
right: 0;
71+
bottom: 2%;
6772
}
6873

6974
& .disc.nucleus-holder {
70-
width: $box-width;
71-
height: $box-height;
72-
border: 0.3em solid transparent;
75+
// width: $box-width;
76+
// height: $box-height;
77+
border: $disc-border-width solid transparent;
7378

7479
& .nucleus {
7580
$nucleus-dimension: 0.8em;
@@ -125,13 +130,18 @@ $colorInversionDegree: 255; // 0 - 255
125130
}
126131
}
127132

128-
@keyframes spinAtom {
133+
/* @keyframes spin-atom {
129134
0% {
130135
transform: rotateX(360deg) rotateY(0deg);
131136
}
132137
100% {
133138
transform: rotateX(0deg) rotateY(360deg);
134139
}
140+
} */
141+
@keyframes spinAtom {
142+
to {
143+
transform: rotate(1turn);
144+
}
135145
}
136146

137147
@keyframes rotateDisc2 {

src/indicators/Atom2/Atom.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@
3838
left: 0;
3939
width: 100%;
4040
height: 100%;
41-
animation: spinAtom var(--spinAtom-duration) linear infinite;
41+
animation: spinAtom2 var(--spinAtom2-duration) linear infinite;
4242

4343
&:has(.electron) {
4444
animation-direction: reverse;
4545
}
4646

4747
&.orbit-holder-1 {
48-
--spinAtom-duration: 2s;
48+
--spinAtom2-duration: 2s;
4949
}
5050
&.orbit-holder-2 {
51-
--spinAtom-duration: 2.5s;
51+
--spinAtom2-duration: 2.5s;
5252
}
5353
&.orbit-holder-3 {
54-
--spinAtom-duration: 2s;
54+
--spinAtom2-duration: 2s;
5555
}
5656

5757
.orbit {
@@ -99,7 +99,7 @@
9999
}
100100
}
101101

102-
@keyframes spinAtom {
102+
@keyframes spinAtom2 {
103103
to {
104104
transform: rotate(1turn);
105105
}

src/indicators/Commet/Commet.scss

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
@use "sass:math";
2+
@use "sass:meta";
3+
14
@use "../../scss/variables" as defaults;
25

3-
$spinCommetDuration: 1.8s;
6+
$spinCommetDuration: 1.4s;
47
$bolus-size: 0.4667em;
58
$commet-path-width: 0.2em;
69

710
@function stripUnit($value) {
8-
@if type-of($value) == "number" and not unitless($value) {
9-
@return $value / ($value * 0 + 1);
11+
@if meta.type-of($value) != "number" {
12+
@error "The type( `#{meta.type-of($value)}` ) is Invalid. Provide a number instead.";
13+
} @else if meta.type-of($value) == "number" and not math.is-unitless($value) {
14+
@return math.div($value, ($value * 0 + 1));
1015
}
1116

12-
@return $number;
17+
@return $value;
1318
}
1419

1520
@function diffRatio($borderWidth, $bolusSize) {
@@ -31,8 +36,8 @@ $commet-path-width: 0.2em;
3136
box-sizing: border-box;
3237

3338
.commet-loader {
34-
width: 4em;
35-
height: 4em;
39+
width: 5em;
40+
height: 5em;
3641
color: defaults.$defaultColor;
3742
display: flex;
3843
align-items: center;

src/indicators/Commet/Commet.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from "react";
33
import { CommetProps } from "./Commet.types";
44
import "./Commet.scss";
55
import useFontsizeMapper from "../../hooks/useFontsizeMapper";
6+
import Text from "../../utils/Text";
67

78
const Commet = (props: CommetProps) => {
89
// Styles
@@ -40,21 +41,11 @@ const Commet = (props: CommetProps) => {
4041
...styles
4142
}}
4243
>
43-
<span
44-
className="rli-d-i-b rli-text-format commet-text"
45-
style={{
46-
...(props?.textColor && {
47-
color: props?.textColor,
48-
mixBlendMode: "unset"
49-
})
50-
}}
51-
>
52-
{props?.text
53-
? typeof props?.text === "string" && props?.text.length
54-
? props?.text
55-
: "loading"
56-
: null}
57-
</span>
44+
<Text
45+
className="commet-text"
46+
text={props?.text}
47+
textColor={props?.textColor}
48+
/>
5849

5950
<span className="rli-d-i-b ring-wrapper ring1">
6051
<span className="rli-d-i-b ring "></span>

src/indicators/GlidingBlink/GlidingBlink.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ $glideAnimDuration: 2s;
9595
transform: translateX(-50%);
9696
color: currentColor;
9797
font-size: 0.7em;
98-
font-weight: 600;
98+
// font-weight: 600;
9999
}
100100

101101
&:after {

0 commit comments

Comments
 (0)