Skip to content

Commit 4ac6fa6

Browse files
authored
Merge branch 'master' into set-accordion-placeholders
2 parents 9a5fa9a + 6b6685f commit 4ac6fa6

File tree

4 files changed

+514
-516
lines changed

4 files changed

+514
-516
lines changed

elements/pfe-band/README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,35 @@ This container element provides a set of slots in which to render banded content
77
All slots other than `pfe-band--body` are optional. If the slot is not defined, the container tag for it will not be rendered in the template.
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 recommended tag for this slot is the `header` tag with h-level or p tags contained within it.
10-
- **Default slot**: This is the default slot and contains the bulk of the content in this element. Paragraph text or a grid of cards or images might be rendered in this region. Recommended tag for this slot is the `article` tag. Any content not assigned to a slot will be rendered here.
10+
- **Default slot**: This unnamed slot should contain the bulk of the content in this element. The recommended wrapper within this slot is the `article` tag, but a `div` could also work to contain text elements like paragraphs. If you are rendering non-text components such as cards or images, no wrapper is necessary, and these items will make use of the grid layout. Any content not assigned to a named slot will be rendered here.
1111
- `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` or `footer`.
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.
1313

14+
### Example markup
15+
```
16+
<pfe-band>
17+
<header slot="pfe-band--header">
18+
<h2>Lighter band; no footer</h2>
19+
</header>
20+
21+
<article>
22+
<p>Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata dolor sit amet.</p>
23+
</article>
24+
25+
<pfe-card slot="pfe-band--aside">
26+
<h3 slot="header">Aside: left body bottom</h3>
27+
<p>Ut wisi enim ad minim veniam.</p>
28+
</pfe-card>
29+
30+
<footer slot="pfe-band--footer">
31+
<pfe-cta slot="footer" priority="tertiary">
32+
<a href="#">Learn more</a>
33+
</pfe-cta>
34+
</footer>
35+
</pfe-band>
36+
```
37+
38+
1439
## Attributes
1540

1641
<style>

elements/pfe-band/demo/index.html

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<noscript>
1010
<link href="../../pfelement/pfelement-noscript.min.css" rel="stylesheet">
1111
</noscript>
12+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap-reboot.css">
1213

1314
<link href="../../pfelement/pfelement.min.css" rel="stylesheet">
1415
<link href="../../pfe-layouts/pfe-layouts.css" rel="stylesheet">
@@ -47,19 +48,6 @@
4748
margin: 0;
4849
}
4950

50-
p,
51-
h1,
52-
h2,
53-
h3 {
54-
margin-top: 0;
55-
}
56-
57-
p:last-child,
58-
h1:last-child,
59-
h2:last-child,
60-
h3:last-child {
61-
margin-bottom: 0;
62-
}
6351
/* Example CSS variable overrides
6452
:root {
6553
--pfe-theme--container-spacer: 4px;
@@ -120,10 +108,12 @@ <h3 slot="header">Aside: right body bottom</h3>
120108
<h2>Lighter band; no footer</h2>
121109
<p class="custom-band-summary">Header region, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
122110
</header>
123-
<p>Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
124-
<pfe-cta priority="tertiary">
125-
<a href="#">Learn more</a>
126-
</pfe-cta>
111+
<article>
112+
<p>Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
113+
<pfe-cta priority="tertiary">
114+
<a href="#">Learn more</a>
115+
</pfe-cta>
116+
</article>
127117
<pfe-card color="complement" slot="pfe-band--aside">
128118
<h3 slot="header">Aside: left body bottom</h3>
129119
<p>Ut wisi enim ad minim veniam.</p>

elements/pfe-band/src/pfe-band.scss

Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
$LOCAL: band;
44

5+
%flex-fallback {
6+
display: flex;
7+
flex-flow: column nowrap;
8+
align-items: flex-start;
9+
margin-bottom: #{pfe-local(gutter--vertical)};
10+
}
11+
12+
%grid-layout {
13+
display: grid;
14+
grid-row-gap: #{pfe-local(gutter--vertical)};
15+
grid-column-gap: #{pfe-local(gutter--horizontal)};
16+
margin-bottom: 0;
17+
}
18+
519
:host {
620
display: block;
721

@@ -55,9 +69,7 @@ $LOCAL: band;
5569

5670
// Wrapper sets padding and background visuals
5771
position: relative;
58-
display: flex;
59-
flex-direction: column;
60-
justify-items: flex-start;
72+
@extend %flex-fallback;
6173

6274
// Padding
6375
padding: calc(#{pfe-local(Padding--vertical)} / 2) #{pfe-local(Padding--horizontal)};
@@ -99,48 +111,6 @@ $LOCAL: band;
99111
--pfe-band--Padding: calc(#{pfe-local(Padding--vertical)} / 4) #{pfe-local(Padding--horizontal)};
100112
}
101113

102-
@each $slot in (default, header, footer, aside) {
103-
$slot-name: $slot;
104-
$grid-area: "body";
105-
@if $slot != default {
106-
$slot-name: "pfe-band--#{$slot-name}";
107-
$grid-area: $slot;
108-
}
109-
.pfe-band__#{$grid-area} {
110-
// Set up the flex styles for each region
111-
display: flex;
112-
flex-flow: column nowrap;
113-
align-items: flex-start;
114-
// Grid support styles
115-
@supports (display: grid) {
116-
grid-area: #{$grid-area};
117-
// Set up the internal grid system for each slot
118-
display: grid;
119-
grid-row-gap: #{pfe-local(gutter--vertical)};
120-
grid-column-gap: #{pfe-local(gutter--horizontal)};
121-
grid-template-columns: #{pfe-local(
122-
$cssvar: layout,
123-
$region: $grid-area
124-
)};
125-
}
126-
}
127-
@include pfe-slot($slot-name, ":not(:last-child)") {
128-
margin-bottom: #{pfe-local(gutter--vertical)};
129-
@supports (display: grid) {
130-
margin-bottom: 0;
131-
}
132-
}
133-
@include pfe-slot($slot-name, "> *") {
134-
margin: 0;
135-
}
136-
@include pfe-slot($slot-name, "> *:not(:last-child)") {
137-
margin-bottom: #{pfe-local(gutter--vertical)};
138-
@supports (display: grid) {
139-
margin-bottom: 0;
140-
}
141-
}
142-
}
143-
144114
.pfe-band {
145115
&__container {
146116
// Does not need to be wrapped in @supports because it updates variables
@@ -230,12 +200,11 @@ $LOCAL: band;
230200
position: relative;
231201
margin: 0 auto;
232202
width: #{pfe-local(Width)};
233-
203+
@extend %flex-fallback;
204+
234205
// Grid support styles
235206
@supports (display: grid) {
236-
display: grid;
237-
grid-row-gap: #{pfe-local(gutter--vertical)};
238-
grid-column-gap: #{pfe-local(gutter--horizontal)};
207+
@extend %grid-layout;
239208
grid-template-columns: #{pfe-local(layout)};
240209
grid-template-rows: max-content;
241210
grid-template-areas: var(--pfe-band--gridTemplateArea_mobile);
@@ -244,4 +213,18 @@ $LOCAL: band;
244213
}
245214
}
246215
}
216+
// For each section in the band layout
217+
@each $section in (header, body, aside, footer) {
218+
&__#{$section} { // i.e., pfe-band__header
219+
@extend %flex-fallback; // Add the flex fallback styles
220+
// Apply the standard grid
221+
@supports (display: grid) {
222+
@extend %grid-layout;
223+
// Apply the section as a named grid-area
224+
grid-area: #{$section};
225+
// Allow users to hook into the layout with custom columns
226+
grid-template-columns: var(--pfe-band__#{$section}--layout);
227+
}
228+
}
229+
}
247230
}

0 commit comments

Comments
 (0)