Skip to content

Commit

Permalink
Replace hero grid layout with CSS grid-based layout
Browse files Browse the repository at this point in the history
  • Loading branch information
contolini committed Nov 1, 2021
1 parent b0e984d commit 83be037
Showing 1 changed file with 16 additions and 59 deletions.
75 changes: 16 additions & 59 deletions packages/cfpb-layout/src/molecules/heroes.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
background-color: @gray-5;

&_wrapper {
padding-top: unit( @grid_gutter-width / @base-font-size-px, em );
padding-bottom: unit( @grid_gutter-width / @base-font-size-px, em );
display: grid;
max-width: ( @grid_wrapper-width - @grid_gutter-width );
margin: 0 auto;
padding-top: @grid_gutter-width;
padding-bottom: @grid_gutter-width;

.respond-to-min( @bp-sm-min, {
// IE specific fix.
display: table;

@supports( display: flex ) {
display: flex;
}
grid-template-columns: 7fr 5fr;
padding-right: ( @grid_gutter-width / 2);
padding-left: ( @grid_gutter-width / 2);

min-height: @hero-desktop-height - ( @grid_gutter-width * 2 );
} );
Expand All @@ -30,11 +30,10 @@
}

&_text {
.grid_column( 1, 1 );
padding-right: ( @grid_gutter-width / 2 );
padding-left: ( @grid_gutter-width / 2 );

.respond-to-min( @bp-sm-min, {
.grid_column( 7, 12 );

// IE specific fix
display: table-cell;
vertical-align: middle;
Expand Down Expand Up @@ -66,12 +65,12 @@
}

&_image-wrapper {
.grid_column( 1, 1 );

box-sizing: border-box;
overflow: hidden;

.respond-to-min( @bp-sm-min, {
.grid_column( 5, 12 );
padding-right: ( @grid_gutter-width / 2 );
padding-left: ( @grid_gutter-width / 2 );

// IE specific fix.
display: table-cell;
Expand All @@ -89,8 +88,6 @@
}

&_image {
.u-flexible-container-mixin( 16, 9 );

background-position: center;
background-repeat: no-repeat;
background-size: contain;
Expand All @@ -104,11 +101,8 @@
&__bleeding {
.respond-to-min( @bp-sm-min, {

.m-hero_wrapper {
position: relative;
}

.m-hero_image-wrapper {
width: 100%;
margin-top: unit( @grid_gutter-width / @base-font-size-px, em ) * -1;
margin-bottom: unit( @grid_gutter-width / @base-font-size-px, em ) * -1;

Expand All @@ -127,7 +121,6 @@
padding-bottom: 0 !important;
height: 100%;
width: 100%;
position: absolute;
background-size: cover;
}
} );
Expand All @@ -153,14 +146,6 @@
// Overwrite the image that is set in the markup because
// we are showing the image container below instead.
background-image: none !important;

// Remove wrapper bottom padding.
padding-bottom: 0;
}

.m-hero_image-wrapper {
position: relative;
border-width: 0;
}
} );

Expand All @@ -176,18 +161,6 @@

.u-jumbo-text();

.respond-to-max( @bp-xs-max, {
.m-hero_wrapper {
// Remove wrapper bottom padding.
padding-bottom: 0;
}

.m-hero_image-wrapper {
border-width: 0;
position: relative;
}
} );

.respond-to-min( @bp-sm-min, {
.m-hero_wrapper {
background-position: 50%;
Expand All @@ -206,20 +179,10 @@

.u-jumbo-text();

.respond-to-max( @bp-xs-max, {
.m-hero_wrapper {
// Remove wrapper bottom padding.
padding-bottom: 0;
}

.m-hero_image-wrapper {
position: relative;
border-width: 0;
}
} );

.respond-to-min( @bp-sm-min, {
.m-hero_wrapper {
grid-template-columns: 1fr 1fr;

border: 1px solid @gray-40;
border-top: none;
// Position the hero image all the way to the right
Expand All @@ -231,12 +194,6 @@
.m-hero_image {
display: none;
}

// Set the hero's text and image to 50%
.m-hero_text,
.m-hero_image-wrapper {
.grid_column( 6, 12 );
}
} );

.respond-to-min( @bp-lg-min, {
Expand Down

0 comments on commit 83be037

Please sign in to comment.