Skip to content

Commit b85a05b

Browse files
authored
refactor: progressbar to tailwind
* refactor: progressbar to tailwind * refactor: move progressbar to tailwind
1 parent e20f547 commit b85a05b

File tree

4 files changed

+11
-47
lines changed

4 files changed

+11
-47
lines changed

projects/ngverse/src/lib/ngverse.css

-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,4 @@
9292
html,
9393
body {
9494
@apply bg-background text-foreground;
95-
96-
background-color: var(--color-background);
97-
color: var(--color-foreground);
9895
}

projects/ngverse/src/lib/progress-bar/progress-bar.component.css

+4-38
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,8 @@
1-
.progress-bar-container {
2-
border-radius: 6px;
3-
position: relative;
4-
overflow-x: hidden;
5-
height: 12px;
6-
border: var(--border);
1+
.inc {
2+
animation: indeterminateIncrease 2s infinite;
73
}
8-
/* determinate */
9-
.determinate-bar {
10-
color: white;
11-
font-size: 8px;
12-
transition: transform 0.3s ease-out;
13-
transform-origin: left;
14-
height: 100%;
15-
background: var(--color-primary);
16-
position: absolute;
17-
text-align: center;
18-
width: 100%;
19-
}
20-
21-
/* indeterminate */
22-
23-
.indeterminate-line {
24-
position: absolute;
25-
opacity: 0.4;
26-
background: var(--color-surface);
27-
width: 150%;
28-
height: 100%;
29-
}
30-
.indeterminate-subline {
31-
position: absolute;
32-
background: var(--color-primary);
33-
height: 100%;
34-
&.inc {
35-
animation: indeterminateIncrease 2s infinite;
36-
}
37-
&.dec {
38-
animation: indeterminateDecrease 2s 0.5s infinite;
39-
}
4+
.dec {
5+
animation: indeterminateDecrease 2s 0.5s infinite;
406
}
417

428
@keyframes indeterminateIncrease {

projects/ngverse/src/lib/progress-bar/progress-bar.component.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<div class="progress-bar-container">
1+
<div class="relative h-3 overflow-x-hidden rounded-md border border-border">
22
@if (indeterminate()) {
3-
<div class="indeterminate-line"></div>
4-
<div class="indeterminate-subline inc"></div>
5-
<div class="indeterminate-subline dec"></div>
3+
<div class="absolute h-full w-[150%] bg-surface opacity-40"></div>
4+
<div class="inc absolute h-full bg-primary"></div>
5+
<div class="dec absolute h-full bg-primary"></div>
66
} @else {
77
<div
8-
class="determinate-bar"
8+
aria-label="progress bar"
9+
class="h-full origin-left bg-primary transition-transform duration-300 ease-in-out"
910
role="progressbar"
1011
[style.transform]="transformValue()"
1112
></div>

projects/ngverse/src/lib/progress-bar/progress-bar.component.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('ProgressBarComponent', () => {
2929
it("should display indeterminate progress bar if 'indeterminate' is true", async () => {
3030
componentRef.setInput('indeterminate', true);
3131
await fixture.whenStable();
32-
const element = fixture.nativeElement.querySelector('.indeterminate-line');
32+
const element = fixture.nativeElement.querySelector('.inc');
3333
expect(element).toBeTruthy();
3434
});
3535
});

0 commit comments

Comments
 (0)