Skip to content
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

Add Logo Group Object #1415

Merged
merged 12 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-olives-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudfour/patterns': minor
---

Add Logo Group object.
11 changes: 11 additions & 0 deletions src/objects/logo-group/demo/demo.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% embed '@cloudfour/objects/container/container.twig' %}
{% block content %}
{% embed '@cloudfour/objects/logo-group/logo-group.twig' %}
{% block content %}
{% for item in items %}
<img src="{{ item.src }}" alt="{{ item.alt }}">
{% endfor %}
{% endblock %}
{% endembed %}
{% endblock %}
{% endembed %}
30 changes: 30 additions & 0 deletions src/objects/logo-group/demo/logos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"alt": "Walmart",
"src": "media/client-logos/logo-walmart.svg"
},
{
"alt": "Deschutes Brewery",
"src": "media/client-logos/logo-deschutes.svg"
},
{
"alt": "Obama '08",
"src": "media/client-logos/logo-obama.svg"
},
{
"alt": "Treasure Coast Hospice",
"src": "media/client-logos/logo-treasurecoast.svg"
},
{
"alt": "Entertainment",
"src": "media/client-logos/logo-entertainment.svg"
},
{
"alt": "Hautelook",
"src": "media/client-logos/logo-hautelook.svg"
},
{
"alt": "Ceasefire Oregon",
"src": "media/client-logos/logo-ceasefire.svg"
}
]
15 changes: 15 additions & 0 deletions src/objects/logo-group/logo-group.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@use "../../compiled/tokens/scss/size";
@use '../../mixins/ms';

.o-logo-group {
align-items: center;
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: (-1 * ms.step(3));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addresses my earlier feedback, but I notice now that this component needs a lot of padding to avoid horizontal scrollbars. Maybe it makes sense to add the padding back to the parent element (instead of requiring utilities), we should just make sure to include adequate comments explaining why... for example, "we add generous padding to balance out the whitespace differentiating brands" or something to that effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the negative margin, curious what you think of it now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dromo77 Did you push that change? I still see the negative margin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No 😆 should be there now.

}

.o-logo-group > * {
margin: ms.step(3);
dromo77 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a design token? Maybe size.spacing.gap.logo_group?

width: size.$width-logo-group-item-width;
}
13 changes: 13 additions & 0 deletions src/objects/logo-group/logo-group.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks';
import defaultDemo from './demo/demo.twig';
dromo77 marked this conversation as resolved.
Show resolved Hide resolved
import logos from './demo/logos.json';

<Meta title="Objects/Logo Group" />

# Logo Group

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.

<Canvas>
<Story name="Default">{defaultDemo({ items: logos })}</Story>
dromo77 marked this conversation as resolved.
Show resolved Hide resolved
</Canvas>
3 changes: 3 additions & 0 deletions src/objects/logo-group/logo-group.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="o-logo-group">
{% block content %}{% endblock %}
</div>
17 changes: 8 additions & 9 deletions src/prototypes/case-study-listings/example/example.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,14 @@
<div class="intro">
<p class="c-heading--level-3">More clients we’ve worked with</p>
</div>
<div class="content">
{% for logos in logos %}
<article>
<header>
<img src="{{logos.image}}"
class="logos">
</header>
</article>
{% endfor %}
<div class="u-pad-block-start-6 u-pad-inline-6">
{% embed '@cloudfour/objects/logo-group/logo-group.twig' %}
{% block content %}
{% for logo in logos %}
<img src="{{ logo.image }}" alt="{{ logo.title }}">
{% endfor %}
{% endblock %}
{% endembed %}
</div>
</div>

Expand Down
6 changes: 6 additions & 0 deletions src/tokens/size/sizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ module.exports = {
comment: 'The minimum space to display a default card in a grid.',
},
},
logo_group: {
item_width: {
value: '9em',
comment: 'The width of individual logos in the logo group.',
},
},
},
square: {
avatar: {
Expand Down