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 all 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"
}
]
21 changes: 21 additions & 0 deletions src/objects/logo-group/logo-group.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@use "../../compiled/tokens/scss/size";
@use '../../mixins/ms';

.o-logo-group {
align-items: center;
display: flex;
flex-wrap: wrap;
justify-content: center;
}

/**
* 1. Because there is generous spacing between the logos, we added a lot of
* white space around Logo Group to help balance the pattern visually.
* Including the spacing as part of the pattern means we don't need to rely
* on utilities.
*/

.o-logo-group > * {
margin: size.$spacing-gap-logo-group; /* 1 */
width: size.$width-logo-group-item-width;
}
27 changes: 27 additions & 0 deletions src/objects/logo-group/logo-group.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks';
// The '!!raw-loader!' syntax is a non-standard, Webpack-specific, syntax.
// See: https://github.com/webpack-contrib/raw-loader#examples
// For now, it seems likely Storybook is pretty tied to Webpack, therefore, we are
// okay with the following Webpack-specific raw loader syntax. It's better to leave
// the ESLint rule enabled globally, and only thoughtfully disable as needed (e.g.
// within a Storybook docs page and not within an actual component).
// This can be revisited in the future if Storybook no longer relies on Webpack.
// eslint-disable-next-line @cloudfour/import/no-webpack-loader-syntax
import defaultDemoSource from '!!raw-loader!./demo/demo.twig';
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"
parameters={{ docs: { source: { code: defaultDemoSource } } }}
>
{defaultDemo({ items: logos })}
</Story>
</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: 7 additions & 10 deletions src/prototypes/case-study-listings/example/example.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,13 @@
<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>
{% 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
3 changes: 3 additions & 0 deletions src/tokens/size/spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ module.exports = {
comment: 'The Form Group default gap spacing.',
},
},
logo_group: {
value: modularEm(3),
},
},
control: {
text_inset: { value: modularEm(-1) },
Expand Down