Skip to content

Commit 3765170

Browse files
markcaronMark Carongithub-actions[bot]heyMP
authored
feat: add color vars to pfe-progress-indicator for styling (#1746)
* Add color vars to pfe-progress-indicator for styling * Updating PFE Progress Indicator README with variable hooks * Adding width and height variable hooks to README. * updating documentation * update changelog Co-authored-by: Mark Caron <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: heyMP <[email protected]>
1 parent 877a1ed commit 3765170

File tree

5 files changed

+35
-12
lines changed

5 files changed

+35
-12
lines changed

CHANGELOG-1.x.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
- [43a904e](https://github.com/patternfly/patternfly-elements/commit/43a904e2ce4f2ef7182f803bf35ade463e7c2f1d) fix: container sass placeholder using incorrect variable for spacing (#1522)
88
- [3d3c4f1](https://github.com/patternfly/patternfly-elements/commit/3d3c4f109a7e09adae3f3f01122846354a278787) fix: accordion rendering slotted content in the header
99
- [519d16a](https://github.com/patternfly/patternfly-elements/commit/519d16af4c714efdc5246f9c0925ca30447b87ea) feat: vertically center pfe-tab content
10-
- [](https://github.com/patternfly/patternfly-elements/commit/) feat: modal width attribute
10+
- [877a1ed](https://github.com/patternfly/patternfly-elements/commit/877a1ed5c6a02cdc5899f8e73007572e831b18a0) feat: modal width attribute
11+
- [](https://github.com/patternfly/patternfly-elements/commit/) feat: add color vars to pfe-progress-indicator for styling
1112

1213

1314
# 1.10.1 (2021-07-12)

elements/pfe-progress-indicator/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ Possible values: `sm`, `md`, `xl`
4444

4545
## Styling
4646

47-
As of writing, the progress indicator element has only one style, but in the future it could be expanded to include many different types of progress indicators.
47+
### Variable hooks
48+
49+
| Variable name | Default value | Use |
50+
| -------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------- |
51+
| `--pfe-progress-indicator--background-color` | rgba(0, 0, 0, .25) | Color of the circle |
52+
| `--pfe-progress-indicator--foreground-color` | rgba(0, 0, 0, .75) | Color of the spinner |
53+
| `--pfe-progress-indicator--Width` | 2rem | Width of the circle |
54+
| `--pfe-progress-indicator--Height` | 2rem | Height of the circle |
4855

4956
## Test
5057

elements/pfe-progress-indicator/demo/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
<link rel="stylesheet" href="../../pfe-styles/dist/pfe-context.css" />
2323
<link rel="stylesheet" href="../../pfe-styles/dist/pfe-layouts.css" />
2424

25+
<style>
26+
:root {
27+
--pfe-progress-indicator--background-color: rgba(0,102,204,.25);
28+
--pfe-progress-indicator--foreground-color: #06c;
29+
}
30+
</style>
31+
2532
<!-- uncomment the es5-adapter if you're using the umd version -->
2633
<script src="https://unpkg.com/@webcomponents/[email protected]/custom-elements-es5-adapter.js"></script>
2734
<script src="https://unpkg.com/@webcomponents/[email protected]/webcomponents-bundle.js"></script>

elements/pfe-progress-indicator/docs/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,11 @@ None
9898

9999
::: section
100100
## Styling hooks
101-
None
101+
102+
| Variable name | Default value | Use |
103+
| -------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------- |
104+
| `--pfe-progress-indicator--background-color` | rgba(0, 0, 0, .25) | Color of the circle |
105+
| `--pfe-progress-indicator--foreground-color` | rgba(0, 0, 0, .75) | Color of the spinner |
106+
| `--pfe-progress-indicator--Width` | 2rem | Width of the circle |
107+
| `--pfe-progress-indicator--Height` | 2rem | Height of the circle |
102108
:::

elements/pfe-progress-indicator/src/pfe-progress-indicator.scss

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import "../../pfe-sass/pfe-sass";
22

3-
$pfe-progress-indicator--border-light: #{pfe-var(surface--border-width--heavy)} #{pfe-var(surface--border-style)} rgba(0, 0, 0, .25);
4-
$pfe-progress-indicator--border-dark: #{pfe-var(surface--border-width--heavy)} #{pfe-var(surface--border-style)} rgba(0, 0, 0, .75);
3+
$pfe-progress-indicator--style: #{pfe-var(surface--border-style)};
4+
$pfe-progress-indicator--width: #{pfe-var(surface--border-width--heavy)};
55

66
:host([hidden]) {
77
display: none;
@@ -15,12 +15,14 @@ $pfe-progress-indicator--border-dark: #{pfe-var(surface--border-width--heavy)} #
1515
-webkit-animation:spin 1s linear infinite;
1616
-moz-animation:spin 1s linear infinite;
1717

18-
border-bottom: $pfe-progress-indicator--border-light;
19-
border-left: $pfe-progress-indicator--border-light;
20-
border-right: $pfe-progress-indicator--border-light;
21-
border-top: $pfe-progress-indicator--border-dark;
18+
border-style: $pfe-progress-indicator--style;
19+
border-width: $pfe-progress-indicator--width;
20+
// @todo 2.0: potentially make default color align with PatternFly, which is #06c
21+
border-color: var(--pfe-progress-indicator--background-color, rgba(0, 0, 0, .25));
22+
border-top-color: var(--pfe-progress-indicator--foreground-color, rgba(0, 0, 0, .75));
23+
2224
border-radius: 100%;
23-
25+
2426
display: inline-block;
2527
height: var(--pfe-progress-indicator--Height, 2rem);
2628
margin: 0 auto;
@@ -33,7 +35,7 @@ $pfe-progress-indicator--border-dark: #{pfe-var(surface--border-width--heavy)} #
3335
:host([size="sm"]) {
3436
height: 1rem;
3537
width: 1rem;
36-
border-width: calc(#{pfe-var(surface--border-width--heavy)} * .75);
38+
border-width: calc(#{pfe-var(surface--border-width--heavy)} * .75);
3739
}
3840

3941
:host([size="md"]) {
@@ -55,4 +57,4 @@ $pfe-progress-indicator--border-dark: #{pfe-var(surface--border-width--heavy)} #
5557
} to {
5658
transform: rotate(360deg);
5759
}
58-
}
60+
}

0 commit comments

Comments
 (0)