-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
D8CORE-628: Add caption option to hero banner. #517
Changes from 9 commits
b298828
3b9d620
4e82f81
22587c7
ab95b64
c76c751
e871a47
57c399a
52c5245
a222470
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@charset "UTF-8"; | ||
|
||
.su-hero--caption { | ||
|
||
// Ensure no card shows up. | ||
.su-hero__card { | ||
display: none; | ||
} | ||
|
||
// The media element shall not be absolute in this option. | ||
.su-hero__media { | ||
@include grid-media('md') { | ||
max-height: map-get($_su-hero-height, 'md'); | ||
position: relative; | ||
} | ||
|
||
@include grid-media('lg') { | ||
max-height: map-get($_su-hero-height, 'lg'); | ||
position: relative; | ||
} | ||
|
||
@include grid-media('xl') { | ||
max-height: map-get($_su-hero-height, 'xl'); | ||
position: relative; | ||
} | ||
} | ||
|
||
.su-hero__content { | ||
@include centered-column; | ||
@include modular-spacing(padding-top, 0); | ||
@include modular-spacing(padding-bottom, 2); | ||
text-align: right; | ||
display: block; | ||
|
||
p { | ||
@include credits; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The caption currently in this PR is larger and darker than it should be, but the credits/caption font sizes and colors are being worked on in my media component PR, so this would fix itself later after that's merged in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm overriding the style for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, that makes total sense. Just want to document here that the base |
||
} | ||
|
||
// Only allow for 60% width on large screen sizes. | ||
@include grid-media('lg') { | ||
@include padding(null null null 40%); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This 40% padding-left looks larger than 40% because it's 40% of the full browser width (including the screen edges) instead of 40% of the center container width. If the width doesn't have to be exactly 60% then it would probably look close enough with padding-left:30%. This issue is more obvious when the browser is really wide (try resizing to 2000px, the caption gets quite narrow). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah, good catch. I was thinking since it was full width but it really isn't. I have revised. |
||
} | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ $_su-hero-height: ( | |
'lg': 640px, | ||
'xl': 728px, | ||
'2xl': 728px | ||
); | ||
) !default; | ||
|
||
.su-hero--youtube { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ $_su-hero-height: ( | |
'lg': 409px, | ||
'xl': 520px, | ||
'2xl': 520px | ||
); | ||
) !default; | ||
|
||
// | ||
// Hero | ||
|
@@ -17,6 +17,7 @@ $_su-hero-height: ( | |
// | ||
// Experimental: The YouTube player has not been finished. | ||
// | ||
// .su-hero--caption - An under banner caption option. | ||
// .su-hero--youtube - A YouTube video in the background. | ||
// | ||
// Markup: ../templates/components/hero/hero.twig | ||
|
@@ -40,6 +41,31 @@ $_su-hero-height: ( | |
@include grid-media('xl') { | ||
min-height: map-get($_su-hero-height, 'xl'); | ||
} | ||
|
||
// The content | ||
.su-hero__card { | ||
background: $su-color-white; | ||
position: relative; | ||
z-index: 10; | ||
|
||
@include grid-media('md') { | ||
@include margin(45px null); | ||
left: 45px; | ||
max-width: 400px; | ||
} | ||
|
||
@include grid-media('lg') { | ||
max-width: 450px; | ||
} | ||
|
||
@include grid-media('xl') { | ||
@include margin(96px null 0 null); | ||
bottom: 48px; | ||
left: 48px; | ||
max-width: 450px; | ||
top: auto; | ||
Comment on lines
+62
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future you might want to finetune the position of the card when the banner is full browser width, but that's probably for another PR. For our WordPress template, if the banner is full width, we line up the edge of the box with the edge of the center container, e.g., if the box/card is on the left, its left edge lines up with the left edge of the logo lockup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is existing code that was outside its scope. Before, this |
||
} | ||
} | ||
} | ||
|
||
// The media element. | ||
|
@@ -72,31 +98,9 @@ $_su-hero-height: ( | |
object-position: 50% 50%; | ||
width: 100%; | ||
} | ||
|
||
} | ||
|
||
// The content | ||
.su-hero__card { | ||
background: $su-color-white; | ||
position: relative; | ||
z-index: 10; | ||
|
||
@include grid-media('md') { | ||
@include margin(45px null); | ||
left: 45px; | ||
max-width: 400px; | ||
} | ||
|
||
@include grid-media('lg') { | ||
max-width: 450px; | ||
} | ||
|
||
@include grid-media('xl') { | ||
@include margin(96px null 0 null); | ||
bottom: 48px; | ||
left: 48px; | ||
max-width: 450px; | ||
top: auto; | ||
} | ||
|
||
// Mostly for the demo. You really shouldn't put content in both the card and the content variables. | ||
.su-hero__content { | ||
display: none; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
|
||
@import | ||
'hero', | ||
'hero--caption', | ||
'hero--youtube'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a @kerri-augenstein question. When the caption container isn't full width, it looks good with
text-align: right
, but I think it looks a bit unnatural at xs to md breakpoints when the caption takes up the full width and the text is still align to the right. Could we make the caption left-aligned or center-aligned at xs to md breakpoints?