Skip to content

Commit 819eef4

Browse files
authored
Use container padding where possible in Ground Nav (#1042)
1 parent 8aef4fe commit 819eef4

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

.changeset/real-comics-play.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': patch
3+
---
4+
5+
Make Ground Nav component whitespace consistent with Container object

src/components/ground-nav/ground-nav.scss

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,28 @@ $_ground-nav-border-width: sizes.$edge-medium;
1414
$_ground-nav-border-style: solid;
1515
$_ground-nav-border-color: colors.$gray-light;
1616

17-
.c-ground-nav__action,
18-
.c-ground-nav__content {
19-
padding: $_ground-nav-space;
17+
/**
18+
* 1. We establish vertical whitespace for the action to simplify alignment of
19+
* the illustration, but other whitespace is assumed to be handled by the
20+
* container object to promote alignment with adjacent sections.
21+
* 2. Allow illustration to be positioned relative to this container.
22+
*/
23+
24+
.c-ground-nav__action {
25+
padding-bottom: $_ground-nav-space; /* 1 */
26+
padding-top: $_ground-nav-space; /* 1 */
27+
position: relative; /* 2 */
2028
}
2129

2230
.c-ground-nav__action-inner {
23-
position: relative;
31+
/**
32+
* Starting at this viewport, we want to position the illustration relative to
33+
* the inner element (away from the nearest horizontal edge).
34+
*/
35+
36+
@media (min-width: breakpoint.$m) {
37+
position: relative;
38+
}
2439

2540
@media (min-width: breakpoint.$l) {
2641
align-items: center;
@@ -47,13 +62,19 @@ $_ground-nav-border-color: colors.$gray-light;
4762
*/
4863

4964
.c-ground-nav__action-illustration {
50-
bottom: $_ground-nav-negative-space;
65+
bottom: 0;
5166
position: absolute;
52-
right: $_ground-nav-negative-space;
67+
right: 0;
5368
width: 40%;
5469

70+
/**
71+
* We position ourselves relative to a max-width container starting at this
72+
* breakpoint, so we have to adjust the bottom position to account for the
73+
* change in whitespace.
74+
*/
75+
5576
@media (min-width: breakpoint.$m) {
56-
right: 0;
77+
bottom: $_ground-nav-negative-space;
5778
width: calc(100% / 3);
5879
}
5980

src/components/ground-nav/ground-nav.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<footer class="c-ground-nav">
1414
{% with action|default({}) %}
15-
<div class="c-ground-nav__action o-container">
15+
<div class="c-ground-nav__action o-container o-container--pad-inline">
1616
<div class="o-container__content c-ground-nav__action-inner">
1717
<h2 class="c-ground-nav__action-lead-in">
1818
{{leadIn}}
@@ -42,7 +42,7 @@
4242
</div>
4343
{% endwith %}
4444

45-
<div class="c-ground-nav__content o-container">
45+
<div class="c-ground-nav__content o-container o-container--pad">
4646
<div class="c-ground-nav__content-inner o-container__content">
4747
<h2 class="u-hidden-visually">
4848
Contact info

0 commit comments

Comments
 (0)