Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Commit

Permalink
Update Capital Framework to include the latest updates to the Design
Browse files Browse the repository at this point in the history
Manual

The documentation in the Design Manual has been updated to include
additional guidelines for heros. This change includes updated rules
about image sizes and spacing. The changes to Capital Framework include
an attempt to simplify the markup and offer additional image sizes
through inline styles.

cfpb/design-manual#461
  • Loading branch information
jimmynotjim committed Apr 13, 2017
1 parent 009bc80 commit bf58a76
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 124 deletions.
2 changes: 1 addition & 1 deletion src/cf-grid/src/cf-grid.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Less variables
//

@grid_wrapper-width: 1200px;
@grid_wrapper-width: 1230px;
@grid_gutter-width: 30px;
@grid_total-columns: 12;
@grid_debug: false;
Expand Down
152 changes: 59 additions & 93 deletions src/cf-layout/src/molecules/heroes.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,32 @@
// Sizing variables

@hero-desktop-height: 285px;
@hero-image-height: 195px;

// Color variables
// $color- variables are from 18F's U.S. Web Design Standards
// https://github.com/18F/web-design-standards/blob/master/src/stylesheets/core/_variables.scss

@hero-bg: #dce4ef; // $color-gray-cool-light
@hero-overlay-bg: #5b616b; // $color-gray
@hero-overlay-text: white;
@hero-knockout-bg: #5b616b; // $color-gray
@hero-knockout-text: white;


.m-hero {
background-color: @hero-bg;

.respond-to-min( @bp-sm-min, {
display: table;
width: 100%;
height: @hero-desktop-height;
} );

&_wrapper {
padding-top: unit( @grid_gutter-width / @base-font-size-px, em );
padding-bottom: unit( @grid_gutter-width / @base-font-size-px, em );

.respond-to-min( @bp-sm-min, {
display: table-row;
display: flex;
min-height: @hero-desktop-height - ( @grid_gutter-width * 2 );
} );

.respond-to-max( @bp-xs-max, {
padding-top: unit( @grid_gutter-width / @base-font-size-px, em );
padding-bottom: unit( @grid_gutter-width / @base-font-size-px, em );
.respond-to-min( @bp-lg-min, {
padding-top: unit( ( @grid_gutter-width * 1.5 ) / @base-font-size-px, em );
padding-bottom: unit( ( @grid_gutter-width * 1.5 ) / @base-font-size-px, em );
min-height: @hero-desktop-height - ( 45px * 2 );
} );
}

Expand All @@ -45,12 +40,11 @@
.respond-to-min( @bp-sm-min, {
.grid_column( 7, 12 );

padding: unit( @grid_gutter-width / @base-font-size-px, em )
unit( 15px / @base-font-size-px, em );
margin: auto;

// Keep the text vertically centered
display: table-cell;
vertical-align: middle;
//display: table-cell;
//vertical-align: middle;
} );
}

Expand All @@ -62,99 +56,85 @@
} );
}

&_subhead,
&_cta:not( .btn ) {
&_subhead {
// Not using the `.heading-3()` mixin here because we want the weight
// to remain Regular on smaller screens.
.u-webfont-regular();

font-size: @size-iv;
font-size: @size-iii;
line-height: 1.25;

.respond-to-min( @bp-med-min, {
font-size: @size-iii;
} );
}

&_subhead:last-child {
margin-bottom: 0;
}

&_cta {
&:not( .btn ) {
border-bottom-width: 1px;
}

.respond-to-min( @bp-sm-min, {
margin-bottom: 0;
.respond-to-max( @bp-sm-max, {
font-size: @size-iv;
} );
}

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

overflow: hidden;

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

margin: auto;

// Keep the image vertically centered
display: table-cell;
vertical-align: middle;
//display: table-cell;
//vertical-align: middle;
} );

.respond-to-max( @bp-xs-max, {
margin-top: unit( @grid_gutter-width / @base-font-size-px, em );
} );
}

&__bleed-vertical {
position: relative;
&_image {
.u-flexible-container-mixin( 16, 9 );

.m-hero_image {
display: block;
height: auto;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
}

&__knockout {
background-color: @hero-knockout-bg;
color: @hero-knockout-text;
}

&__bleeding {
.respond-to-min( @bp-sm-min, {
.m-hero_image-wrapper {
position: relative;

margin-top: unit( @grid_gutter-width / @base-font-size-px, em ) * -1;
margin-bottom: unit( @grid_gutter-width / @base-font-size-px, em ) * -1;
}

.m-hero_image__bleeding {
width: 100%;
height: 100%;
position: absolute;
top: 0;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
.m-hero_image-wrapper {
display: flex;
align-items: center;
}

.respond-to-max( @bp-xs-max, {
.m-hero_image__bleeding {
display: none;
}
} );

.respond-to-min( @bp-sm-min, {
.m-hero_image {
display: none;
}
} );

.respond-to-min( @bp-med-min, {
.m-hero_image {
display: none;
}
} );
}
}
.m-hero_image {
.u-flexible-container-mixin( 470, 640 );

&_image {
// height is the same as min-height in a table
height: unit( @hero-image-height / @base-font-size-px, em );
width: 100%;
position: absolute;
}
} );

background-position: center;
background-repeat: no-repeat;
background-size: contain;
.respond-to-min( @bp-lg-min, {
.m-hero_image-wrapper {
margin-top: unit( ( @grid_gutter-width * 1.5 ) / @base-font-size-px, em ) * -1;
margin-bottom: unit( ( @grid_gutter-width * 1.5 ) / @base-font-size-px, em ) * -1;
}
} );
}

&__overlay {
background-repeat: no-repeat;
background-size: cover;
background-position: center;

.respond-to-max( @bp-xs-max, {
// Overwrite the image that is set in the markup because
Expand All @@ -167,28 +147,14 @@
}

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

.m-hero_image {
background-size: cover;
}
} );

.respond-to-min( @bp-sm-min, {
.m-hero_image {
// Overwrite the image but don't remove the container from
// the grid flow. Necessary due to table-cell.
background: transparent !important;
}
} );
}

&__overlay-text {
.respond-to-min( @bp-sm-min, {
.m-hero_wrapper {
background-color: @hero-overlay-bg;
color: @hero-overlay-text;
display: none;
}
} );
}
Expand Down
Loading

0 comments on commit bf58a76

Please sign in to comment.