Skip to content

Commit eeefd4e

Browse files
authored
Add o-deck--4-column modifiers (#1480)
1 parent 65f8b85 commit eeefd4e

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

.changeset/sweet-geckos-smile.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': minor
3+
---
4+
5+
Add o-deck--4-column modifiers

src/objects/deck/deck.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
* maximum or to coordinate with adjacent elements.
4646
*/
4747

48-
@for $i from 2 through 3 {
48+
@for $i from 2 through 4 {
4949
.o-deck--#{$i}-column {
5050
@include media-query.breakpoint-classes($from: s, $to: xl) {
5151
grid-template-columns: repeat(#{$i}, 1fr);

src/objects/deck/deck.stories.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const articlesTemplateSource = (_src, storyContext) => {
3636
control: {
3737
type: 'range',
3838
min: 2,
39-
max: 3,
39+
max: 4,
4040
step: 1,
4141
},
4242
defaultValue: 3,
@@ -86,7 +86,7 @@ By default, the `o-deck` class will use CSS Grid Layout to arrange child element
8686

8787
While automatic columns are convenient, there are times when a specific column count is desired. For example, you may want to limit a design to three columns at larger breakpoints to align with adjacent elements.
8888

89-
To do this, add a modifier class in the format of `o-deck--X-column@Y`, where `X` is the desired column count (from 2 to 3) and `Y` is the desired [breakpoint](/docs/design-tokens-breakpoint--page) (from `s` to `xl`). In this example, we force the grid to display three columns starting from the `m` breakpoint.
89+
To do this, add a modifier class in the format of `o-deck--X-column@Y`, where `X` is the desired column count (from 2 to 4) and `Y` is the desired [breakpoint](/docs/design-tokens-breakpoint--page) (from `s` to `xl`). In this example, we force the grid to display three columns starting from the `m` breakpoint.
9090

9191
<Canvas>
9292
<Story

src/prototypes/team/example/team-list.scss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,4 @@
3131
}
3232
}
3333
}
34-
35-
.team-container {
36-
display: grid;
37-
grid-gap: ms.step(0);
38-
grid-template-columns: repeat(auto-fill, minmax(11.5em, 1fr));
39-
40-
@media (min-width: breakpoint.$l) {
41-
grid-template-columns: repeat(auto-fill, minmax(15.25em, 1fr));
42-
}
43-
}
4434
}

src/prototypes/team/example/team-list.twig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@
5858
{% embed '@cloudfour/objects/container/container.twig' with {
5959
"class": "o-container--pad" } %}
6060
{% block content %}
61-
<div class="team-container">
61+
{% embed '@cloudfour/objects/deck/deck.twig' with {
62+
class: 'o-deck--2-column@s o-deck--4-column@l',
63+
avatars: avatars
64+
} only %}
65+
{% block content %}
6266
{% for avatar in avatars %}
6367
{% embed '@cloudfour/components/card/card.twig' with { href: '#', avatar: avatar, class: 'team-member' } only %}
6468
{% block heading %}
@@ -72,7 +76,8 @@
7276
{% endblock %}
7377
{% endembed %}
7478
{% endfor %}
75-
</div>
79+
{% endblock %}
80+
{% endembed %}
7681
{% endblock %}
7782
{% endembed %}
7883
{% include '@cloudfour/components/ground-nav/ground-nav.twig' with {

0 commit comments

Comments
 (0)