From 3900a07a3a864fdf239e6ad5e60aa9a1b0e08043 Mon Sep 17 00:00:00 2001 From: Bartek Szopka Date: Mon, 23 Mar 2020 17:07:30 +0100 Subject: [PATCH] Fix flex grid fallback for IE in stepped list component --- scss/_base_grid-definitions.scss | 16 ++++++++++++++++ scss/_patterns_grid.scss | 26 +++++++------------------- scss/_patterns_lists.scss | 26 ++++++++++++++++++-------- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/scss/_base_grid-definitions.scss b/scss/_base_grid-definitions.scss index 490b392d3..528711666 100644 --- a/scss/_base_grid-definitions.scss +++ b/scss/_base_grid-definitions.scss @@ -19,6 +19,7 @@ // default to flexbox for IE display: flex; + flex-wrap: wrap; & & { @include vf-b-row-reset; @@ -84,3 +85,18 @@ } } } + +// flexbox approximation of grid column styles for IE +// this needs to be a @mixin rather than %placeholder because it's ised inside @media queries +@mixin vf-grid-flex-column { + flex-basis: 0; + flex-grow: 1; + flex-shrink: 1; + + // set static gutter width + margin-left: map-get($grid-gutter-widths, large); + + &:first-child { + margin-left: 0; + } +} diff --git a/scss/_patterns_grid.scss b/scss/_patterns_grid.scss index 94b61cb0d..62689fca1 100644 --- a/scss/_patterns_grid.scss +++ b/scss/_patterns_grid.scss @@ -8,23 +8,8 @@ } } -@mixin vf-grid-column($col, $screen: large) { - // on large screens provide flex box column implementation for IE - // on smaller screens let them display full width one under another - @if $screen == large { - flex-basis: 0; - flex-grow: 1; - flex-shrink: 1; - - // set static gutter width - margin-left: map-get($grid-gutter-widths, $screen); - - &:first-child { - margin-left: 0; - } - } - - // CSS grid implementation of columns for all screens sizes +// CSS grid implementation of columns for all screens sizes +@mixin vf-grid-column($col) { @supports (display: grid) { grid-column-end: span #{$col}; @@ -78,7 +63,7 @@ @media (max-width: $threshold-4-6-col) { @for $i from $grid-columns-small through 1 { .#{$grid-small-col-prefix}#{$i} { - @include vf-grid-column($i, small); + @include vf-grid-column($i); width: 100%; } } @@ -88,7 +73,7 @@ @media (min-width: $threshold-4-6-col) and (max-width: $threshold-6-12-col) { @for $i from $grid-columns-medium through 1 { .#{$grid-medium-col-prefix}#{$i} { - @include vf-grid-column($i, medium); + @include vf-grid-column($i); width: 100%; } } @@ -99,6 +84,9 @@ @for $i from $grid-columns through 1 { // set col-* to span respective number of columns on desktop .#{$grid-large-col-prefix}#{$i} { + // on large screens provide flex box column implementation for IE + // on smaller screens let them display full width one under another + @include vf-grid-flex-column; @include vf-grid-column($i); } } diff --git a/scss/_patterns_lists.scss b/scss/_patterns_lists.scss index f94729885..57cc61bc3 100644 --- a/scss/_patterns_lists.scss +++ b/scss/_patterns_lists.scss @@ -206,17 +206,27 @@ $spv-list-item--inner: null; margin-left: auto; - .p-stepped-list__content { - @media (min-width: $threshold-6-12-col) { - grid-column-end: span 6; - margin-top: 0; + // fallback for IE flex box grid implementation + @media (min-width: $threshold-6-12-col) { + .p-stepped-list__content, + .p-stepped-list__title { + @include vf-grid-flex-column; } } - .p-stepped-list__title { - display: flex; - grid-column-end: span 6; - margin-left: 0; + @supports (display: grid) { + .p-stepped-list__content { + @media (min-width: $threshold-6-12-col) { + grid-column-end: span 6; + margin-top: 0; + } + } + + .p-stepped-list__title { + display: flex; + grid-column-end: span 6; + margin-left: 0; + } } .p-stepped-list__item {