-
Notifications
You must be signed in to change notification settings - Fork 1
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
Streamfield wrapper overhaul and featured tiles style #101
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
{% load wagtailcore_tags wagtailimages_tags %} | ||
{% image self.image width-400 as img_base %} | ||
<div class="feature"> | ||
<div class="feature__text-content"> | ||
<h2>{{ self.heading }}</h2> | ||
{{ self.feature_text|richtext }} | ||
{% if self.cta_buttons %} | ||
{% include_block self.cta_buttons %} | ||
{% endif %} | ||
</div> | ||
|
||
{% image self.image width-750 as img_base %} | ||
{% image self.image width-1200 as img_sm %} | ||
{% image self.image width-1400 as img_md %} | ||
<div class="block block--feature"> | ||
<div class="feature"> | ||
<div class="feature__text-content"> | ||
<h2>{{ self.heading }}</h2> | ||
{{ self.feature_text|richtext }} | ||
{% if self.cta_buttons %} | ||
{% include_block self.cta_buttons %} | ||
{% endif %} | ||
</div> | ||
|
||
<picture class="feature__img"> | ||
<source srcset="{{ img_sm.url }}" media="(min-width: 500px)"> | ||
<source srcset="{{ img_md.url }}" media="(min-width: 768px)"> | ||
<img | ||
src="{{ img_base.url }}" | ||
alt="{{ self.alt_text|default:img_base.alt }}" | ||
loading="lazy" | ||
/> | ||
</picture> | ||
{% image self.image width-750 as img_base %} | ||
{% image self.image width-1200 as img_sm %} | ||
{% image self.image width-1400 as img_md %} | ||
|
||
<picture class="feature__img"> | ||
<source srcset="{{ img_sm.url }}" media="(min-width: 500px)"> | ||
<source srcset="{{ img_md.url }}" media="(min-width: 768px)"> | ||
<img | ||
src="{{ img_base.url }}" | ||
alt="{{ self.alt_text|default:img_base.alt }}" | ||
loading="lazy" | ||
/> | ||
</picture> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
{% load wagtailcore_tags %} | ||
{{ self | richtext }} | ||
<div class="block block--paragraph"> | ||
{{ self | richtext }} | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
.tiles--featured { | ||
@include full-bleed-bg(var(--color-grey-5)); | ||
padding-block: 40px; | ||
|
||
@include md { | ||
padding-block: 72px; | ||
} | ||
} | ||
|
||
// Wrapper for component title and 'see more' link, both of | ||
// which are optional. Only renders if content is present. | ||
.tiles__title-wrapper { | ||
|
@@ -34,7 +43,7 @@ | |
row-gap: 40px; | ||
|
||
@include sm { | ||
grid-template-columns: repeat(auto-fit, minmax(px2rem(280), 1fr)); | ||
grid-template-columns: repeat(auto-fill, minmax(px2rem(280), 1fr)); | ||
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. Whoops. This meant that tiles block with only one tile had a big full-width tile, which we don't want. I always get these two confused. |
||
column-gap: 32px; | ||
} | ||
} | ||
|
@@ -48,6 +57,7 @@ | |
.tile__text { | ||
grid-row: 2; | ||
grid-column: 1; | ||
background-color: var(--color-white); | ||
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. Because the component bg can now be grey. But the tile should always have a white bg. |
||
border: 8px solid var(--color-brand-100); | ||
border-top: none; | ||
padding: 24px 12px; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
Regarding content migrated as part of Springload's 2024 rebuild. | ||
Existing content was dumped into a "migrated" content streamfield block. | ||
*/ | ||
.migrated-content { | ||
.block--migrated-content { | ||
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 another special case. I mean, I could add another wrapper but I don't intend to add any styling for this content at this stage. |
||
:where(h2) { | ||
@include md { | ||
margin-left: calc(-1 * var(--content-outdent)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ | |
<div class="content-width grid-standard page-layout page-layout--without-sidenav"> | ||
<div class="page-layout__main-content"> | ||
<div class="streamfields-wrapper"> | ||
{% if page.body %} | ||
{% include_block page.body %} | ||
{% endif %} | ||
{% for block in page.body %} | ||
{% include_block block %} | ||
{% endfor %} | ||
Comment on lines
+11
to
+13
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 the method that stops rendering the auto-generated wrapping divs. I have applied it everywhere we loop over streamfields. |
||
</div> | ||
</div> | ||
</div> | ||
|
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.
For the most part I'm not styling these
.block--x
classes in terms of component styling. Mainly just for streamfield-wrapper spacing and alignment.Newsletter is a special case because I want to keep the DOM light, as it's also used as a non-streamfield block in the footer.