Skip to content

Commit 3c102fa

Browse files
Add Logo Group Object (#1415)
* Add logo group object * Update changelog * Update margin to remove extra white space around logos * Update pattern structure * Update logo alt text * Update prototype with logo-group * Update size token * Update comments in stories Co-authored-by: Gerardo Rodriguez <[email protected]> * Update story code Co-authored-by: Gerardo Rodriguez <[email protected]> * Remove negative margins * Update margin and comment Co-authored-by: Gerardo Rodriguez <[email protected]>
1 parent 0974e3f commit 3c102fa

File tree

9 files changed

+113
-10
lines changed

9 files changed

+113
-10
lines changed

.changeset/spotty-olives-watch.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 Logo Group object.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% embed '@cloudfour/objects/container/container.twig' %}
2+
{% block content %}
3+
{% embed '@cloudfour/objects/logo-group/logo-group.twig' %}
4+
{% block content %}
5+
{% for item in items %}
6+
<img src="{{ item.src }}" alt="{{ item.alt }}">
7+
{% endfor %}
8+
{% endblock %}
9+
{% endembed %}
10+
{% endblock %}
11+
{% endembed %}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"alt": "Walmart",
4+
"src": "media/client-logos/logo-walmart.svg"
5+
},
6+
{
7+
"alt": "Deschutes Brewery",
8+
"src": "media/client-logos/logo-deschutes.svg"
9+
},
10+
{
11+
"alt": "Obama '08",
12+
"src": "media/client-logos/logo-obama.svg"
13+
},
14+
{
15+
"alt": "Treasure Coast Hospice",
16+
"src": "media/client-logos/logo-treasurecoast.svg"
17+
},
18+
{
19+
"alt": "Entertainment",
20+
"src": "media/client-logos/logo-entertainment.svg"
21+
},
22+
{
23+
"alt": "Hautelook",
24+
"src": "media/client-logos/logo-hautelook.svg"
25+
},
26+
{
27+
"alt": "Ceasefire Oregon",
28+
"src": "media/client-logos/logo-ceasefire.svg"
29+
}
30+
]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@use "../../compiled/tokens/scss/size";
2+
@use '../../mixins/ms';
3+
4+
.o-logo-group {
5+
align-items: center;
6+
display: flex;
7+
flex-wrap: wrap;
8+
justify-content: center;
9+
}
10+
11+
/**
12+
* 1. Because there is generous spacing between the logos, we added a lot of
13+
* white space around Logo Group to help balance the pattern visually.
14+
* Including the spacing as part of the pattern means we don't need to rely
15+
* on utilities.
16+
*/
17+
18+
.o-logo-group > * {
19+
margin: size.$spacing-gap-logo-group; /* 1 */
20+
width: size.$width-logo-group-item-width;
21+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks';
2+
// The '!!raw-loader!' syntax is a non-standard, Webpack-specific, syntax.
3+
// See: https://github.com/webpack-contrib/raw-loader#examples
4+
// For now, it seems likely Storybook is pretty tied to Webpack, therefore, we are
5+
// okay with the following Webpack-specific raw loader syntax. It's better to leave
6+
// the ESLint rule enabled globally, and only thoughtfully disable as needed (e.g.
7+
// within a Storybook docs page and not within an actual component).
8+
// This can be revisited in the future if Storybook no longer relies on Webpack.
9+
// eslint-disable-next-line @cloudfour/import/no-webpack-loader-syntax
10+
import defaultDemoSource from '!!raw-loader!./demo/demo.twig';
11+
import defaultDemo from './demo/demo.twig';
12+
import logos from './demo/logos.json';
13+
14+
<Meta title="Objects/Logo Group" />
15+
16+
# Logo Group
17+
18+
Logo Group can be used to display a group of client logos. Logos break onto multiple lines depending on the available space and are vertically centered.
19+
20+
<Canvas>
21+
<Story
22+
name="Default"
23+
parameters={{ docs: { source: { code: defaultDemoSource } } }}
24+
>
25+
{defaultDemo({ items: logos })}
26+
</Story>
27+
</Canvas>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="o-logo-group">
2+
{% block content %}{% endblock %}
3+
</div>

src/prototypes/case-study-listings/example/example.twig

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,13 @@
100100
<div class="intro">
101101
<p class="c-heading--level-3">More clients we’ve worked with</p>
102102
</div>
103-
<div class="content">
104-
{% for logos in logos %}
105-
<article>
106-
<header>
107-
<img src="{{logos.image}}"
108-
class="logos">
109-
</header>
110-
</article>
111-
{% endfor %}
112-
</div>
103+
{% embed '@cloudfour/objects/logo-group/logo-group.twig' %}
104+
{% block content %}
105+
{% for logo in logos %}
106+
<img src="{{ logo.image }}" alt="{{ logo.title }}">
107+
{% endfor %}
108+
{% endblock %}
109+
{% endembed %}
113110
</div>
114111

115112
</div>

src/tokens/size/sizing.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ module.exports = {
2929
comment: 'The minimum space to display a default card in a grid.',
3030
},
3131
},
32+
logo_group: {
33+
item_width: {
34+
value: '9em',
35+
comment: 'The width of individual logos in the logo group.',
36+
},
37+
},
3238
},
3339
square: {
3440
avatar: {

src/tokens/size/spacing.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ module.exports = {
4646
comment: 'The Form Group default gap spacing.',
4747
},
4848
},
49+
logo_group: {
50+
value: modularEm(3),
51+
},
4952
},
5053
control: {
5154
text_inset: { value: modularEm(-1) },

0 commit comments

Comments
 (0)