Skip to content

Commit 5378a09

Browse files
committed
fix(band): correct grid template for fullheight aside
closes #1983
1 parent 8fa0920 commit 5378a09

File tree

2 files changed

+76
-72
lines changed

2 files changed

+76
-72
lines changed

elements/pfe-band/pfe-band.scss

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ $regions-grid: (
190190
.pfe-band__container {
191191
margin: 0 auto;
192192

193+
display: grid;
194+
grid-template-rows: auto;
195+
grid-template-columns: auto;
196+
197+
grid-template-areas: "body";
198+
199+
grid-row-gap: pfe-local(gutter--vertical);
200+
row-gap: pfe-local(gutter--vertical);
201+
grid-column-gap: pfe-local(gutter--horizontal);
202+
column-gap: pfe-local(gutter--horizontal);
203+
193204
:host(:not([full-width])) & {
194205
max-width: pfe-local(Width);
195206
// Loop through the other breakpoints
@@ -200,98 +211,85 @@ $regions-grid: (
200211
}
201212
}
202213

203-
@supports (display: grid) {
204-
display: grid;
205-
grid-template-rows: auto;
206-
grid-template-columns: auto;
207-
208-
grid-template-areas: "body";
214+
// Styles for the different combination of regions
215+
//-- Grid template area styles --//
216+
@each $selectors, $layout in $regions-grid {
217+
$sets: ();
218+
$has-aside: str-index($selectors, "aside");
209219

210-
grid-row-gap: pfe-local(gutter--vertical);
211-
row-gap: pfe-local(gutter--vertical);
212-
grid-column-gap: pfe-local(gutter--horizontal);
213-
column-gap: pfe-local(gutter--horizontal);
220+
@each $region in str-split($selectors, "-") {
221+
$sets: append($sets, ".has-#{$region}");
222+
}
214223

215-
// Styles for the different combination of regions
216-
//-- Grid template area styles --//
217-
@each $selectors, $layout in $regions-grid {
218-
$sets: ();
219-
$has-aside: str-index($selectors, "aside");
224+
// Combine the sets into a selector
225+
$regions: to-string($sets, "");
220226

221-
@each $region in str-split($selectors, "-") {
222-
$sets: append($sets, ".has-#{$region}");
223-
}
227+
// Declare the mobile-first layouts
228+
&#{$regions} {
229+
grid-template-areas: $layout;
230+
}
224231

225-
// Combine the sets into a selector
226-
$regions: to-string($sets, "");
232+
// If there is an aside region, create variants for
233+
// 1. mobile top placement
234+
// 2. desktop left positioning
235+
// 3. full height layout
227236

228-
// Declare the mobile-first layouts
229-
&#{$regions} {
230-
grid-template-areas: $layout;
237+
@if ($has-aside) {
238+
// 0-MD breakpoint
239+
@media (max-width: pfe-breakpoint(md, $max: true)) {
240+
&#{$regions}[aside-mobile="top"] {
241+
grid-template-areas: aside-grid($layout);
242+
}
231243
}
232244

233-
// If there is an aside region, create variants for
234-
// 1. mobile top placement
235-
// 2. desktop left positioning
236-
// 3. full height layout
237-
238-
@if ($has-aside) {
239-
// 0-MD breakpoint
240-
@media (max-width: pfe-breakpoint(md, $max: true)) {
241-
&#{$regions}[aside-mobile="top"] {
242-
grid-template-areas: aside-grid($layout);
243-
}
245+
// MD+ breakpoint
246+
@media (min-width: pfe-breakpoint(md)) {
247+
&#{$regions} {
248+
grid-template-areas: aside-grid($layout, $bp: desktop);
244249
}
245250

246-
// MD+ breakpoint
247-
@media (min-width: pfe-breakpoint(md)) {
248-
&#{$regions} {
249-
grid-template-areas: aside-grid($layout, $bp: desktop);
250-
}
251+
&#{$regions}[aside-desktop="left"] {
252+
grid-template-areas: aside-grid($layout, $position: left, $bp: desktop);
253+
}
251254

252-
&#{$regions}[aside-desktop="left"] {
253-
grid-template-areas: aside-grid($layout, $position: left, $bp: desktop);
255+
@if length($layout) > 2 {
256+
&#{$regions}[aside-height="full"] {
257+
grid-template-areas: aside-grid($layout, $full: true, $bp: desktop);
254258
}
255259

256-
@if length($layout) > 2 {
257-
&#{$regions}[aside-height="full"] {
258-
grid-template-areas: aside-grid($layout, $full: true, $bp: desktop);
259-
}
260-
261-
&#{$regions}[aside-desktop="left"][aside-height="full"] {
262-
grid-template-areas: aside-grid($layout, $full: true, $position: left, $bp: desktop);
263-
}
260+
&#{$regions}[aside-desktop="left"][aside-height="full"] {
261+
grid-template-areas: aside-grid($layout, $full: true, $position: left, $bp: desktop);
264262
}
265263
}
266264
}
267-
268265
}
269-
//-- END grid template area styles --//
270266

271-
@media (min-width: pfe-breakpoint(md)) {
272-
grid-template-rows: auto;
273-
grid-template-columns: 1fr;
267+
}
268+
//-- END grid template area styles --//
274269

275-
&.has-aside {
276-
grid-template-rows: auto;
277-
grid-template-columns: 1fr pfe-local(Width__aside--sm);
278-
}
270+
@media (min-width: pfe-breakpoint(md)) {
271+
grid-template-rows: auto;
272+
grid-template-columns: 1fr;
279273

280-
&.has-aside[aside-desktop="left"] {
281-
grid-template-rows: auto;
282-
grid-template-columns: pfe-local(Width__aside--sm) 1fr;
283-
}
274+
&.has-aside {
275+
grid-template-rows: auto;
276+
grid-template-columns: 1fr pfe-local(Width__aside--sm);
284277
}
285278

286-
@media (min-width: pfe-breakpoint(lg)) {
287-
&.has-aside {
288-
grid-template-rows: auto;
289-
grid-template-columns: pfe-local(layout, $fallback: 1fr pfe-local(Width__aside--lg));
290-
}
291-
&.has-aside[aside-desktop="left"] {
292-
grid-template-rows: auto;
293-
grid-template-columns: pfe-local(layout, $fallback: pfe-local(Width__aside--lg) 1fr);
294-
}
279+
&.has-aside[aside-desktop="left"] {
280+
grid-template-rows: auto;
281+
grid-template-columns: pfe-local(Width__aside--sm) 1fr;
282+
}
283+
}
284+
285+
@media (min-width: pfe-breakpoint(lg)) {
286+
&.has-aside {
287+
grid-template-rows: auto;
288+
grid-template-columns: pfe-local(layout, $fallback: 1fr pfe-local(Width__aside--lg));
289+
}
290+
&.has-aside[aside-desktop="left"] {
291+
grid-template-rows: auto;
292+
grid-template-columns: pfe-local(layout, $fallback: pfe-local(Width__aside--lg) 1fr);
295293
}
296294
}
297295

@@ -363,3 +361,9 @@ slot[name="pfe-band--aside"] {
363361
}
364362
}
365363
}
364+
365+
@media (min-width: 768px) {
366+
:host([aside-height="full"]) #container.has-header.has-aside {
367+
grid-template-areas: "header aside" "body aside";
368+
}
369+
}

elements/pfe-band/pfe-band.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class PfeBand extends LitElement {
190190
: html`<div class="pfe-band__wrapper" part="wrapper">${content}</div>`;
191191

192192
return html`
193-
<section class="pfe-band__container ${classMap({
193+
<section id="container" class="pfe-band__container ${classMap({
194194
'has-header': hasSlottedHeader,
195195
'has-body': hasSlottedBody,
196196
'has-aside': hasSlottedAside,

0 commit comments

Comments
 (0)