Skip to content

Commit f4880d6

Browse files
castastrophegithub-actions[bot]starryeyez024
authored
fix: Reduce unnecessary interpolation and function calls (#1042)
* fix: Reduce unnecessary interpolation and function calls * fix: Reduce pfe-print-local for clarity * fix: update changelog * fix: Run files through prettier * fix: Update package lock? * fix: Update changelog * fix: Organize pfe-band for readability * fix: Adjust jump-links to fix minor bug * Update elements/pfe-accordion/src/pfe-accordion-panel.scss * fix: Bring back width values; leave empty var * fix: Update components * fix: Resolve bugs in remaining band styles * fix: Adding comments * fix: Fix content set display bug; icon visuals * fix: Update icon template * fix: Resolve extra padding on landing page; add template for grid to remove console notice * fix: Tidy up IE11 bugs for pfe-band * fix: Update documentation * fix: Add missing closing bracket so it compiles * fix: Fix pfe-band sass changes * fix: Adjust the margin settings * fix: Fix IE11 float overflow Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Kendall Totten <[email protected]>
1 parent f50368b commit f4880d6

File tree

49 files changed

+724
-648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+724
-648
lines changed

CHANGELOG-1.x.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
- [6eadb21](https://github.com/patternfly/patternfly-elements/commit/6eadb21a29768c06ff312de42bd54b44072ee051) fix: umd.min modules now import umd.min builds of PFE dependencies (#1168)
1515
- [40e0b09](https://github.com/patternfly/patternfly-elements/commit/40e0b099e77943feee4e8ba1a34d25b01ddf86ff) fix: global theme palette color for visited links in a saturated context
1616
- [117a0e7](https://github.com/patternfly/patternfly-elements/commit/117a0e7e407ea1244cc861b251391f61a8b143ef) fix: Variable references to theme vs. context
17-
- [7c7093a1](https://github.com/patternfly/patternfly-elements/commit/7c7093a1b4d099941320558e54003a0beca01eda) fix: ie11 pfe-cta link text and padding issues
18-
- [](https://github.com/patternfly/patternfly-elements/commit/) feat: Add theming to storybook
17+
- [a02d6e5](https://github.com/patternfly/patternfly-elements/commit/a02d6e57f9e444b28cde9676d70c0e16a5dca4d9) fix: ie11 pfe-cta link text and padding issues
18+
- [f50368b](https://github.com/patternfly/patternfly-elements/commit/f50368b0bbb1141dc805ef2ceb4f86203e90ceff) fix: Storybook bug fixes; jump links updates
19+
- [](https://github.com/patternfly/patternfly-elements/commit/) fix: Reduce unnecessary interpolation and function calls (#1042)

docs/content/develop/properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class PfeCount extends PFElement {
161161
}
162162

163163
handleCount(oldVal, newVal) {
164-
console.log(`count changed from ${oldVal} to ${newVal}`);
164+
this.log(`count changed from ${oldVal} to ${newVal}`);
165165
}
166166

167167
}

docs/content/develop/step-2d.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class PfeCoolElement extends PFElement {
7777
}
7878
7979
_clickHandler(event) {
80-
console.log("Button clicked!!!");
80+
this.log("Button clicked!!!");
8181
this.follow = !this.follow;
8282
}
8383
@@ -165,7 +165,7 @@ constructor() {
165165
}
166166
```
167167

168-
Now, we'll add the `pfe-photo-url` attribute to our `observedAttributes`:
168+
Now, we'll add the `photo-url` attribute to our `observedAttributes`:
169169

170170
```
171171
static get observedAttributes() {

elements/pfe-accordion/demo/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ <h3>Panel with CTA</h3>
212212

213213
<section class="light-gray-background">
214214
<h2>&lt;pfe-accordion&gt;</h2><br />
215-
<pfe-accordion>
215+
<pfe-accordion id="dynamic-accordion">
216216
<pfe-accordion-header>
217217
<h3>Why do wizards need money if they could just create it?</h3>
218218
</pfe-accordion-header>
@@ -599,7 +599,7 @@ <h3>Not a disclosure because disclosure=false</h3>
599599

600600
<script>
601601
var btn = document.querySelector("#addTabAndPanelBtn");
602-
var pfeAccordion = document.querySelector("pfe-accordion");
602+
var pfeAccordion = document.querySelector("pfe-accordion#dynamic-accordion");
603603

604604
btn.addEventListener("click", function () {
605605
var fragment = document.createDocumentFragment();

elements/pfe-accordion/src/pfe-accordion-header.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
}
5757

5858
:host(:last-of-type.animating) button {
59-
@include pfe-print-local((BorderBottomWidth: 0));
59+
--pfe-accordion--BorderBottomWidth: 0;
6060
}
6161

6262
// Styles based on background color
@@ -78,7 +78,7 @@ button[aria-expanded="true"] {
7878

7979
:host([disclosure="true"]) {
8080
button {
81-
padding-left: calc((#{pfe-local(Padding, $region: base)} * 3));
81+
padding-left: calc(#{pfe-local(Padding, $region: base)} * 3);
8282
@include browser-query(ie11) {
8383
padding: 16px 24px 16px 47px;
8484
border-right-color: pfe-fetch(surface--border);

elements/pfe-accordion/src/pfe-accordion-panel.scss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,10 @@
1919
.container {
2020
@include pfe-clearfix;
2121
@include pfe-panel-container;
22-
@include pfe-print-local((
23-
panel-container: (
24-
Padding: 0 calc(#{pfe-local(Padding, $region: base)} * 3) #{pfe-local(Padding, $region: base)} calc(#{pfe-local(Padding, $region: base)} * 1.5)
25-
)
26-
));
22+
--pfe-accordion__panel-container--Padding: 0 calc(#{pfe-local(Padding, $region: base)} * 3) #{pfe-local(Padding, $region: base)} calc(#{pfe-local(Padding, $region: base)} * 1.5);
2723

2824
:host([disclosure="true"]) & {
29-
@include pfe-print-local((
30-
panel-container: (
31-
Padding: 0 calc(#{pfe-local(Padding, $region: base)} * 1.5)
32-
)
33-
));
25+
--pfe-accordion__panel-container--Padding: 0 calc(#{pfe-local(Padding, $region: base)} * 1.5);
3426
}
3527
}
3628

elements/pfe-accordion/src/pfe-accordion.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ class PfeAccordion extends PFElement {
3737
oldDisclosure: {
3838
type: String,
3939
alias: "disclosure",
40-
attr: "pfe-disclosure",
41-
cascade: ["pfe-accordion-header", "pfe-accordion-panel"]
40+
attr: "pfe-disclosure"
4241
},
4342
role: {
4443
type: String,
4544
default: "tablist",
46-
values: ["tablist"],
47-
prefix: false
45+
values: ["tablist"]
4846
}
4947
};
5048
}

elements/pfe-accordion/src/pfe-accordion.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import "shared-assets";
22

33
:host {
4+
// @TODO remove this eventually to allow empty local variables
45
@include pfe-print-local($LOCAL-VARIABLES);
56
display: block;
67
position: relative;
@@ -26,3 +27,7 @@
2627
$disclosure: pfe-accordion-variables($variant: disclosure);
2728
@include pfe-print-local($disclosure);
2829
}
30+
31+
:host([hidden]) {
32+
display: none;
33+
}

elements/pfe-band/README.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ All slots other than `pfe-band--body` are optional. If the slot is not defined,
88

99
- `pfe-band--header`: This slot renders at the top of the container and generally contains the title, headline, and/or subheadline content. Other possible candidates include a set of social sharing links or tags that describe the content below. The template is automatically wrapping this slot in a `header` tag. Recommend using h-level or p tags inside this slot.
1010
- **Default slot**: This unnamed slot should contain the bulk of the content in this element. The template is automatically wrapping all content within an `article` tag.
11-
- `pfe-band--footer`: This slot is typically used for calls-to-action or footnotes and is pushed to the bottom of the container. Recommended tags include `pfe-cta`.The template is automatically wrapping this slot in a `footer` tag.
11+
- `pfe-band--footer`: This slot is typically used for calls-to-action or footnotes and is pushed to the bottom of the container. Recommended tags include `pfe-cta`. The template is automatically wrapping this slot in a `footer` tag.
1212
- `pfe-band--aside`: This slot is for content that should be rendered to the right or left of the default slot on desktop. Asides often contain `pfe-card` or interest forms which provide users a little more information or context for the band. The template is automatically wrapping this slot in an `aside` tag.
1313

1414
### Example markup
@@ -45,27 +45,43 @@ All slots other than `pfe-band--body` are optional. If the slot is not defined,
4545

4646
There are several attributes available for customizing the visual treatment of this container.
4747

48-
- `pfe-color`: Options include darkest, darker, accent, complement, lighter, lightest. The band has a default value of `#dfdfdf`. Your context will influence these colors so check there first if you are seeing inconsistencies.
48+
- `color`: Options include darkest, darker, accent, complement, lighter, lightest. The band has a default value of `#dfdfdf`. Your context will influence these colors so check there first if you are seeing inconsistencies.
4949

5050
| color | hex |
5151
|-------|-----|
52-
| default | <span class="color-preview" style="--bg:#dfdfdf"></span> #dfdfdf |
53-
| darker | <span class="color-preview" style="--bg:#464646"></span> #464646 |
54-
| darkest | <span class="color-preview" style="--bg:#131313"></span> #131313 |
55-
| accent | <span class="color-preview" style="--bg:#ee0000"></span> #ee0000 |
56-
| complement | <span class="color-preview" style="--bg:#0477a4"></span> #0477a4 |
57-
| lighter | <span class="color-preview" style="--bg:#ececec"></span> #ececec |
52+
| base/default | <span class="color-preview" style="--bg:#f0f0f0"></span> #f0f0f0 |
53+
| darker | <span class="color-preview" style="--bg:#3c3f42"></span> #3c3f42 |
54+
| darkest | <span class="color-preview" style="--bg:#151515"></span> #151515 |
55+
| accent | <span class="color-preview" style="--bg:#004080"></span> #004080 |
56+
| complement | <span class="color-preview" style="--bg:#002952"></span> #002952 |
57+
| lighter | <span class="color-preview" style="--bg:#f0f0f0"></span> #f0f0f0 |
5858
| lightest | <span class="color-preview" style="--bg:#fff"></span> #ffffff |
5959

60-
- `pfe-img-src`: Optional background image applied to the entire band container. Alignment of this image can be managed using the `--pfe-band--BackgroundPosition` variable which is set to `center center` by default.
61-
- `pfe-size`: Optionally adjusts the padding on the container. Accepts: `small`.
60+
- `img-src`: Optional background image applied to the entire band container. Alignment of this image can be managed using the `--pfe-band--BackgroundPosition` variable which is set to `center center` by default.
61+
- `size`: Optionally adjusts the padding on the container. Accepts: `small`.
62+
- `use-grid`: This turns on a default grid inside the header, body, footer, and aside regions. The grid can be customized using the following CSS variables:
63+
64+
| Variable name | Default |
65+
|---|---|
66+
| `--pfe-band__header--layout` | 1fr |
67+
| `--pfe-band__header--gutter--vertical` | var(--pfe-theme--container-spacer, 16px) |
68+
| `--pfe-band__header--gutter--horizontal` | calc(var(--pfe-theme--container-spacer, 16px) * 3) |
69+
| `--pfe-band__body--layout` | 1fr |
70+
| `--pfe-band__body--gutter--vertical` | var(--pfe-theme--container-spacer, 16px) |
71+
| `--pfe-band__body--gutter--horizontal` | calc(var(--pfe-theme--container-spacer, 16px) * 3) |
72+
| `--pfe-band__footer--layout` | 1fr |
73+
| `--pfe-band__footer--gutter--vertical` | var(--pfe-theme--container-spacer, 16px) |
74+
| `--pfe-band__footer--gutter--horizontal` | calc(var(--pfe-theme--container-spacer, 16px) * 3) |
75+
| `--pfe-band__aside--layout` | 1fr |
76+
| `--pfe-band__aside--gutter--vertical` | var(--pfe-theme--container-spacer, 16px) |
77+
| `--pfe-band__aside--gutter--horizontal` | calc(var(--pfe-theme--container-spacer, 16px) * 3) |
6278

6379
### Aside settings
6480
The aside settings have defaults and if no attribute is defined on the element's main tag, these attributes will be injected with their default values automatically.
6581

66-
- `pfe-aside-desktop`: This influences where the aside is rendered at the desktop view and are indicated relative to the body content. Options are `right` or `left`. **Right is the default.**
67-
- `pfe-aside-mobile`: This influences the position of the aside in the mobile view as well as where in the DOM the aside markup is rendered. These names are relative to the body content. Options are `top` or `bottom`. **Bottom is the default.**
68-
- `pfe-aside-height`: This influences the height of the aside region relative to the body content. Options are `full` or `body`. A `full` height starts at the top of the band and spans the header, body, and footer regions. A `body` height spans the body and footer regions only with the header region sitting above it in the rendered view. **Body is the default.**
82+
- `aside-desktop`: This influences where the aside is rendered at the desktop view and are indicated relative to the body content. Options are `right` or `left`. **Right is the default.**
83+
- `aside-mobile`: This influences the position of the aside in the mobile view as well as where in the DOM the aside markup is rendered. These names are relative to the body content. Options are `top` or `bottom`. **Bottom is the default.**
84+
- `aside-height`: This influences the height of the aside region relative to the body content. Options are `full` or `body`. A `full` height starts at the top of the band and spans the header, body, and footer regions. A `body` height spans the body and footer regions only with the header region sitting above it in the rendered view. **Body is the default.**
6985

7086
## Variables
7187
There are several powerful variables available to hook into and override default styles.
@@ -74,12 +90,7 @@ There are several powerful variables available to hook into and override default
7490
- **Background color**: Though using the `pfe-color` attribute is strongly recommended when setting the background color for the band, you can also use completely custom colors by updating the `--pfe-band--BackgroundColor` variable. If you update this value manually, you should also update the `--context` context variable to invoke the right context on it and it's child elements. Supported contexts include: `light`, `dark`, and `saturated`.
7591
- **Background position**: This is designed for use with the `pfe-img-src` attribute to allow you to align your background image. Default value is `center center`.
7692
- **Border**: This allows the customization of a border around the entire container and is primarily designed to be used to add a top and/or bottom border line. This variable accepts the entire border shorthand and is set to transparent by default.
77-
- **Layout**: The band has a rudimentary layout system designed to be used inside the slot regions for the header, body, footer, and aside. It uses the CSS grid spec and creates a stacked layout by default. By updating these values, you will be able to create simple grid layouts. Please note that these do not include fallbacks for older browsers. Possible values include: `1fr 1fr`, `repeat(3, 1fr)`, `repeat(auto-fill, minmax(300px, 1fr))`
78-
* `--pfe-band--layout`: Applied to `.pfe-band__container`.
79-
* `--pfe-band_header--layout`: Applied to `.pfe-band__header`.
80-
* `--pfe-band_body--layout`: Applied to `.pfe-band__body`.
81-
* `--pfe-band_footer--layout`: Applied to `.pfe-band__footer`.
82-
* `--pfe-band_aside--layout`: Applied to `.pfe-band__aside`.
93+
- **Layout**: The band has a rudimentary layout system designed to be used inside the slot regions for the header, body, footer, and aside (see `use-grid` attribute details above). The regions themselves are also wrapped in a grid system that supports customization. All layouts appears "stacked" by default. Please note that the fallback for older browsers is a simple stacked layout (the aside position will be aligned using floats). Possible values include: `1fr 1fr`, `repeat(3, 1fr)`, `repeat(auto-fill, minmax(300px, 1fr))`. i.e., `--pfe-band--layout: repeat(auto-fill, minmax(300px, 1fr));`.
8394

8495
## Test
8596

@@ -89,11 +100,11 @@ There are several powerful variables available to hook into and override default
89100

90101
npm run build
91102

92-
## Demo
103+
## Develop
93104

94105
From the PFElements root directory, run:
95106

96-
npm start
107+
npm dev pfe-band
97108

98109
## Code style
99110

elements/pfe-band/demo/demo.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
body {
2+
margin: 0;
3+
}
4+
5+
/* Example CSS variable overrides
6+
:root {
7+
--pfe-theme--container-spacer: 4px;
8+
}
9+
10+
pfe-band {
11+
--pfe-band--Padding--vertical: 1px;
12+
--pfe-band--Padding--horizontal: 1px;
13+
--pfe-band_aside--layout: 380px;
14+
}
15+
*/
16+
17+
/* Set typography styles using a class */
18+
.custom-band-summary {
19+
font-size: 20px;
20+
margin: 0;
21+
}
22+
23+
.custom-footnote ol {
24+
list-style: none;
25+
counter-reset: my-counter;
26+
margin: 0;
27+
padding: 0;
28+
}
29+
30+
.custom-footnote li:before {
31+
content: "["counter(my-counter) "] ";
32+
counter-increment: my-counter;
33+
font-size: .8em;
34+
vertical-align: super;
35+
}
36+
37+
.custom-band {
38+
--pfe-band--BackgroundColor: hotpink;
39+
--context: saturated;
40+
}
41+
42+
.custom-card {
43+
--pfe-card--BackgroundColor: transparent;
44+
--pfe-card--Border: 1px solid #fff;
45+
}
46+
47+
#test-custom {
48+
--pfe-band--BackgroundColor: green;
49+
--context: saturated;
50+
}
51+
52+
#custom-layout {
53+
--pfe-band__body--layout: repeat(auto-fit, minmax(250px, 1fr));
54+
}

0 commit comments

Comments
 (0)