-
Notifications
You must be signed in to change notification settings - Fork 3
Add "Overview" object for use on the Article Listing page #1406
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
Changes from all commits
e81a3f5
460fe34
7eabae6
4a09415
ac2b129
18fe99e
3766284
8c32edf
6965bc8
97501b4
f85d9f1
4263de7
1b7245c
5d25302
63efb3d
1e532a2
463c9cd
45224f2
4435c0b
074105d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@cloudfour/patterns': major | ||
| --- | ||
|
|
||
| Renamed the Heading property from `permalink_id` to `id` and allowed you to use `id` when `permalink` is false. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@cloudfour/patterns': minor | ||
| --- | ||
|
|
||
| Added Overview object for use in Article Listings |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| {% embed '@cloudfour/objects/overview/overview.twig' with { | ||
| labelledby_id: 'more-topics' | ||
| } %} | ||
| {% block header %} | ||
| {% include '@cloudfour/components/heading/heading.twig' with { | ||
| level: -1, | ||
| weight: "light", | ||
| content: 'More Topics', | ||
| id: 'more-topics' | ||
| } only %} | ||
| {% endblock %} | ||
| {% block actions %} | ||
| {# | ||
| In the future we could swap this out for the Input Group component | ||
| that's currently in the works. | ||
| #} | ||
| <label> | ||
| <span class="u-hidden-visually">Search</span> | ||
| {% include '@cloudfour/components/input/input.twig' %} | ||
| </label> | ||
| {% endblock %} | ||
| {% block content %} | ||
| {% embed '@cloudfour/objects/list/list.twig' with { | ||
| "tag_name": "ul", | ||
| "class": "o-list--2-column@m o-list--3-column@l" | ||
| } %} | ||
| {% block content %} | ||
| {% for topic in topics %} | ||
| <li class="u-space-block-end-0"> | ||
| {% include '@cloudfour/components/dot-leader/dot-leader.twig' with { | ||
| label: topic.title, | ||
| count: topic.count, | ||
| href: 'https://cloudfour.com/thinks/' | ||
| } only %} | ||
| </li> | ||
| {% endfor %} | ||
| {% endblock %} | ||
| {% endembed %} | ||
| {% endblock %} | ||
| {% endembed %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| {% embed '@cloudfour/objects/overview/overview.twig' %} | ||
| {% block header %} | ||
| Header | ||
| {% endblock %} | ||
| {% block actions %} | ||
| Actions | ||
| {% endblock %} | ||
| {% block content %} | ||
| Content | ||
| {% endblock %} | ||
| {% endembed %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| @use "../../compiled/tokens/scss/breakpoint"; | ||
| @use '../../mixins/ms'; | ||
| @use "../../compiled/tokens/scss/size"; | ||
| @use '../../mixins/fluid'; | ||
|
|
||
| /** | ||
| * The Overview stacks content vertically on small screens. | ||
| * On large screens the header and actions are stacked horizontally above the content. | ||
| * The specific spacing values were inferred from the Article Listing prototype. | ||
| */ | ||
|
|
||
| .o-overview__header { | ||
| margin-bottom: ms.step(1); | ||
| } | ||
|
|
||
| .o-overview__actions { | ||
| margin-bottom: ms.step(3); | ||
| } | ||
|
|
||
| @supports (display: grid) { | ||
|
Comment on lines
+12
to
+20
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think this is necessary? We aren't optimizing for IE, and the content seems perfectly accessible without grid if the spacing's a little off in this section. I'm open to it, I was just surprised to see these fallbacks and then the margin resets later on for a relatively simple layout object.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have strong feelings here. The only change for IE11 was the All that said, I'm totally fine removing the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't realize the margin resets were also a responsive concern. In that case this isn't much cruft at all. |
||
| @media (min-width: breakpoint.$l) { | ||
| .o-overview { | ||
| @include fluid.column-gap( | ||
| breakpoint.$s, | ||
| breakpoint.$xl, | ||
| size.$spacing-gap-fluid-min, | ||
| size.$spacing-gap-fluid-max | ||
| ); | ||
|
Comment on lines
+23
to
+28
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm torn on this. I think it's probably fine, just typing out my initial pause.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had initially used That said, I don't have strong feelings about it and would be fine swapping over. |
||
|
|
||
| align-items: center; | ||
| display: grid; | ||
| grid-template-areas: | ||
| 'header header actions' | ||
| 'content content content'; | ||
| grid-template-columns: repeat(3, 1fr); | ||
| row-gap: ms.step(3); | ||
| } | ||
|
|
||
| .o-overview__header, | ||
| .o-overview__actions { | ||
| margin: 0; | ||
| } | ||
|
|
||
| .o-overview__header { | ||
| grid-area: header; | ||
| } | ||
|
|
||
| .o-overview__actions { | ||
| grid-area: actions; | ||
| } | ||
|
|
||
| .o-overview__content { | ||
| grid-area: content; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks'; | ||
| import basicDemo from './demo/basic.twig'; | ||
| import advancedDemo from './demo/advanced.twig'; // 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 basicDemoSource from '!!raw-loader!./demo/basic.twig'; | ||
| // eslint-disable-next-line @cloudfour/import/no-webpack-loader-syntax | ||
| import advancedDemoSource from '!!raw-loader!./demo/advanced.twig'; | ||
| import topics from '../../components/dot-leader/demo/topics.json'; | ||
|
|
||
| <!-- | ||
| Inline stories disabled so media queries will behave as expected within | ||
| embedded examples. | ||
| --> | ||
|
|
||
| <Meta | ||
| title="Objects/Overview" | ||
| parameters={{ docs: { inlineStories: false } }} | ||
| /> | ||
|
|
||
| # Overview | ||
|
|
||
| The Overview object can be used to provide an overview of a site section. For example, it is used to provide an index of article categories, as well as a form to search for articles. | ||
|
|
||
| It handles the responsive layout of `header`, `actions`, and `content` blocks. On small screens they are stacked vertically. On large screens the `header` and `actions` blocks stack horizontally above the `content` block. | ||
|
|
||
| It should usually be placed in a [Container](/docs/objects-container--basic). | ||
|
|
||
| <Canvas> | ||
| <Story | ||
| name="Basic" | ||
| height="300px" | ||
| parameters={{ | ||
| docs: { | ||
| source: { | ||
| code: basicDemoSource, | ||
| }, | ||
| }, | ||
| }} | ||
| > | ||
| {basicDemo()} | ||
| </Story> | ||
| </Canvas> | ||
|
|
||
| ## Advanced Usage | ||
|
|
||
| Here's a more complex usage example, showing how the Overview object could be used on the article listing page. | ||
|
|
||
| <Canvas> | ||
| <Story | ||
| name="Advanced Usage" | ||
| height="300px" | ||
| parameters={{ | ||
| docs: { | ||
| source: { | ||
| code: advancedDemoSource, | ||
| }, | ||
| }, | ||
| }} | ||
| > | ||
| {advancedDemo({ topics })} | ||
| </Story> | ||
| </Canvas> | ||
|
|
||
| ## Template Properties | ||
|
|
||
| - `overview_tag` - defaults to `section` but can be switched out for any HTML tag. | ||
| - `labelledby_id` - an optional ID to use with the `aria-labelledby` attribute. | ||
|
|
||
| ## Template blocks | ||
|
|
||
| - `header` - should generally contain a [Heading](/docs/components-heading--levels) | ||
| - `actions` - could contain a searchbar or other actions | ||
| - `content` the primary overview content. For example, a list of categories. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <{{overview_tag|default('section')}} | ||
| class="o-overview" | ||
| {% if labelledby_id %}aria-labelledby="{{labelledby_id}}"{% endif %} | ||
| > | ||
| <header class="o-overview__header"> | ||
| {% block header %}{% endblock %} | ||
| </header> | ||
| <div class="o-overview__actions"> | ||
| {% block actions %}{% endblock %} | ||
| </div> | ||
| <div class="o-overview__content"> | ||
| {% block content %}{% endblock %} | ||
| </div> | ||
| </{{overview_tag|default('section')}}> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,31 +74,8 @@ | |
| } | ||
| } | ||
|
|
||
| .topics-header { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This prototype CSS was replaced by the new Object CSS. |
||
| padding-bottom: ms.step(3); | ||
|
|
||
| @media (min-width: breakpoint.$l) { | ||
| display: grid; | ||
| @include fluid.grid-gap( | ||
| breakpoint.$s, | ||
| breakpoint.$xl, | ||
| size.$spacing-gap-fluid-min, | ||
| size.$spacing-gap-fluid-max | ||
| ); | ||
| grid-template-columns: repeat(3, minmax(max-content, 1fr)); | ||
| padding-bottom: ms.step(3); | ||
| } | ||
| } | ||
|
|
||
| .search-content { | ||
| align-items: center; | ||
| display: flex; | ||
| grid-column: 3 / -1; | ||
| padding-top: ms.step(1); | ||
|
|
||
| @media (min-width: breakpoint.$l) { | ||
| padding-top: 0; | ||
| } | ||
| } | ||
|
|
||
| .search-input { | ||
|
|
@@ -115,24 +92,4 @@ | |
| .search-btn .c-icon { | ||
| font-size: ms.step(1); | ||
| } | ||
|
|
||
| .topics-content { | ||
| @media (min-width: breakpoint.$m) { | ||
| columns: 2; | ||
| @include fluid.grid-gap( | ||
| breakpoint.$s, | ||
| breakpoint.$xl, | ||
| size.$spacing-gap-fluid-min, | ||
| size.$spacing-gap-fluid-max | ||
| ); | ||
| } | ||
|
|
||
| @media (min-width: breakpoint.$l) { | ||
| columns: 3; | ||
| } | ||
| } | ||
|
|
||
| .topics-content li { | ||
| margin-bottom: ms.step(0); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is technically a breaking change, though as far as I can tell we're not using
permalink_idanywhere yet.