Skip to content

Commit ea9eda5

Browse files
committed
fix(progressbar): remove shared file, optimize css output for linear gradient
1 parent ef31822 commit ea9eda5

File tree

5 files changed

+36
-65
lines changed

5 files changed

+36
-65
lines changed

src/components/progress/themes/circular/circular.progress.base.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'styles/common/component';
22
@use 'styles/utilities' as *;
33
@use '../animations' as *;
4-
@use '../shared' as *;
54
@use '../vars' as *;
65

76
[part~='base'] {
Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
11
@use 'styles/utilities' as *;
22
@use '../light/themes' as *;
33
@use '../../vars' as *;
4-
@use '../../shared' as *;
54
@use '../../animations' as *;
65

76
$theme: $bootstrap;
8-
$stripe-size: rem(5px);
97

108
:host {
119
--track-size: #{rem(16px)};
1210
}
1311

14-
// Define a mixin for generating striped styles
15-
@mixin striped-styles($part, $color-key) {
16-
[part~='striped'][part~='#{$part}']:not([part~='indeterminate']) {
17-
@include stripe-colors(var-get($theme, $color-key), var-get($theme, 'stripes-color'), $stripe-size, 45deg);
18-
}
19-
[part~='striped'][part~='#{$part}'] {
20-
&::after {
21-
@include stripe-colors(var-get($theme, $color-key), var-get($theme, 'stripes-color'), $stripe-size, 45deg);
22-
}
23-
}
12+
:host([striped]) {
13+
--stripe-size: #{rem(5px)};
2414
}
25-
26-
// Apply the mixin for each part
27-
@include striped-styles('primary', 'fill-color-default');
28-
@include striped-styles('danger', 'fill-color-danger');
29-
@include striped-styles('warning', 'fill-color-warning');
30-
@include striped-styles('info', 'fill-color-info');
31-
@include striped-styles('success', 'fill-color-success');
Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'styles/utilities' as *;
22
@use '../light/themes' as *;
33
@use '../../vars' as *;
4-
@use '../../shared' as *;
54
@use '../../animations' as *;
65

76
$theme: $material;
@@ -15,38 +14,51 @@ $theme: $material;
1514
color: var-get($theme, 'text-color');
1615
}
1716

18-
// Mixin for base background styles
19-
@mixin background-styles($part, $color-key) {
20-
[part~='#{$part}']:not([part~='indeterminate']) {
21-
background-color: var-get($theme, $color-key);
22-
}
23-
[part~='#{$part}'] {
24-
&::after {
25-
background-color: var-get($theme, $color-key);
26-
}
27-
}
17+
:host([striped]) {
18+
--stripe-size: #{rem(16px)};
2819
}
2920

30-
// Mixin for striped styles
31-
@mixin striped-styles($part, $color-key) {
32-
[part~='striped'][part~='#{$part}']:not([part~='indeterminate']) {
33-
@include stripe-colors(var-get($theme, $color-key), var-get($theme, 'stripes-color'), $stripe-size, -45deg);
21+
@mixin part-styles($part, $color-key) {
22+
:host([variant='#{$part}']) {
23+
--fill-bg: #{var-get($theme, $color-key)};
3424
}
35-
[part~='striped'][part~='#{$part}'] {
36-
&::after {
37-
@include stripe-colors(var-get($theme, $color-key), var-get($theme, 'stripes-color'), $stripe-size, -45deg);
38-
}
25+
26+
:host([striped][variant='#{$part}']) {
27+
--striped-bg: #{var-get($theme, $color-key) repeating-linear-gradient(
28+
-45deg,
29+
var-get($theme, $color-key),
30+
var-get($theme, $color-key) var(--stripe-size),
31+
var-get($theme, 'stripes-color') var(--stripe-size),
32+
var-get($theme, 'stripes-color') calc(var(--stripe-size) * 2)
33+
)};
3934
}
4035
}
4136

42-
// Apply styles for different parts
37+
// Generate styles for each variant
4338
@each $part, $color-key in (
4439
'primary': 'fill-color-default',
4540
'danger': 'fill-color-danger',
4641
'warning': 'fill-color-warning',
4742
'info': 'fill-color-info',
4843
'success': 'fill-color-success'
4944
) {
50-
@include background-styles($part, $color-key);
51-
@include striped-styles($part, $color-key);
45+
@include part-styles($part, $color-key);
46+
}
47+
48+
:host(:not([indeterminate])) {
49+
[part~='fill'] {
50+
background-color: var(--fill-bg);
51+
}
52+
}
53+
54+
[part~='fill'] {
55+
&::after {
56+
background-color: var(--fill-bg);
57+
}
58+
}
59+
60+
:host([striped]:not([indeterminate])) {
61+
[part~='fill'] {
62+
background: var(--striped-bg);
63+
}
5264
}

src/components/progress/themes/shared.scss

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/components/progress/themes/vars.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'styles/utilities' as *;
22

33
$background-size: #{rem(40px)} #{rem(40px)};
4-
$stripe-size: rem(16px);
54
$animation-direction: normal;
65
$animation-direction-rtl: reverse;
76
$diameter: calc(var(--circular-size) + var(--stroke-thickness));

0 commit comments

Comments
 (0)