diff --git a/.changeset/early-carrots-appear.md b/.changeset/early-carrots-appear.md
new file mode 100644
index 000000000..3e1e2cae6
--- /dev/null
+++ b/.changeset/early-carrots-appear.md
@@ -0,0 +1,5 @@
+---
+'@cloudfour/patterns': minor
+---
+
+Add `o-container__fill` and `o-container__fill-pad` elements for content intended to stretch into inline container padding
diff --git a/src/mixins/_fluid.scss b/src/mixins/_fluid.scss
index d63f31a3c..f6728da7a 100644
--- a/src/mixins/_fluid.scss
+++ b/src/mixins/_fluid.scss
@@ -108,6 +108,23 @@
}
}
+@mixin margin-inline($min-width, $max-width, $min, $max, $include-min: true) {
+ @if $include-min {
+ margin-inline-end: $min;
+ margin-inline-start: $min;
+ }
+
+ @media (min-width: $min-width) {
+ margin-inline-end: fluid-calc($min-width, $max-width, $min, $max);
+ margin-inline-start: fluid-calc($min-width, $max-width, $min, $max);
+ }
+
+ @media (min-width: $max-width) {
+ margin-inline-end: $max;
+ margin-inline-start: $max;
+ }
+}
+
@mixin padding($min-width, $max-width, $min, $max, $include-min: true) {
@if $include-min {
padding: $min;
diff --git a/src/objects/container/container.scss b/src/objects/container/container.scss
index f77d2dedb..ae3a6f0ed 100644
--- a/src/objects/container/container.scss
+++ b/src/objects/container/container.scss
@@ -62,3 +62,60 @@ $pad-max: size.$padding-container-max;
max-width: size.$max-width-prose;
}
}
+
+/**
+ * Child elements intended to "fill" the container width. This negates any
+ * inline padding and border radii.
+ */
+
+.o-container__fill,
+.o-container__fill-pad {
+ .o-container--pad &,
+ .o-container--pad-inline & {
+ @include fluid.margin-inline(
+ $pad-breakpoint-min,
+ $pad-breakpoint-max,
+ $pad-min * -1,
+ $pad-max * -1
+ );
+ }
+
+ .o-container--pad:not(.o-container--prose) &,
+ .o-container--pad-inline:not(.o-container--prose) & {
+ // Magic number corresponds to approximate size of fluid padding in addition
+ // to max width container without fluid font size applied (attempts to boil
+ // this down to a repeatable equation resulted in my head exploding). If we
+ // only tested by the max width, the rounded corners would be restored too
+ // early (before there was visible whitespace to either side).
+ @media (width < (size.$max-width-spread + 25em)) {
+ border-radius: 0;
+ }
+ }
+
+ .o-container--pad.o-container--prose &,
+ .o-container--pad-inline.o-container--prose & {
+ // See previous comment about magic number
+ @media (width < (size.$max-width-prose + 7em)) {
+ border-radius: 0;
+ }
+ }
+}
+
+/**
+ * The `__fill-pad` element differs from the `__fill` element in that it
+ * restores the parent element's padding (if any). This may be useful for cards
+ * and theme containers with inner content that wouldn't align with what was
+ * adjacent otherwise.
+ */
+
+.o-container__fill-pad {
+ .o-container--pad &,
+ .o-container--pad-inline & {
+ @include fluid.padding-inline(
+ $pad-breakpoint-min,
+ $pad-breakpoint-max,
+ $pad-min,
+ $pad-max
+ );
+ }
+}
diff --git a/src/objects/container/container.stories.mdx b/src/objects/container/container.stories.mdx
index 6d2659d83..e821aeebc 100644
--- a/src/objects/container/container.stories.mdx
+++ b/src/objects/container/container.stories.mdx
@@ -1,5 +1,16 @@
-import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks';
+import { Story, Canvas, Meta } from '@storybook/addon-docs';
import basicDemo from './demo/basic.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 fillDemoSource from '!!raw-loader!./demo/fill.twig';
+import fillDemo from './demo/fill.twig';
const basicDemoStory = (args) => {
const modifiers = [];
if (args.prose) {
@@ -24,7 +35,11 @@ embedded examples.
+
This card simply fills the content element:
+ {% embed '@cloudfour/components/card/card.twig' with { + class: 'c-card--contained' + } only %} + {% block content %} +.c-card.c-card--contained
+ {% endblock %} + {% endembed %} +This card attempts to fill the container, padding included:
+ {% embed '@cloudfour/components/card/card.twig' with { + class: 'c-card--contained o-container__fill' + } only %} + {% block content %} +.c-card.c-card--contained.o-container__fill
+ {% endblock %} + {% endembed %} +This card fills the container and applies padding to align its content with adjacent elements:
+ {% embed '@cloudfour/components/card/card.twig' with { + class: 'c-card--contained o-container__fill-pad' + } only %} + {% block content %} +.c-card.c-card--contained.o-container__fill-pad
+ {% endblock %} + {% endembed %} + {% endblock %} + {% endembed %} + {% endblock %} +{% endembed %} diff --git a/src/prototypes/single-article/example/example.scss b/src/prototypes/single-article/example/example.scss deleted file mode 100644 index 7fa704b78..000000000 --- a/src/prototypes/single-article/example/example.scss +++ /dev/null @@ -1,25 +0,0 @@ -@use "../../../mixins/ms"; -@use "../../../compiled/tokens/scss/size"; -@use "../../../compiled/tokens/scss/breakpoint"; - -#single-article { - .main-container { - padding-top: ms.step(6); - padding-bottom: ms.step(6); - } - - - .bio-card { - @media (min-width: breakpoint.$s) { - margin-left: -1em; - margin-right: -1em; - border-radius: 0; - } - - @media (min-width: breakpoint.$m) { - margin-left: 0; - margin-right: 0; - border-radius: size.$border-radius-medium; - } - } -} diff --git a/src/prototypes/single-article/example/example.twig b/src/prototypes/single-article/example/example.twig index a23bc84e4..a2b0fdc52 100644 --- a/src/prototypes/single-article/example/example.twig +++ b/src/prototypes/single-article/example/example.twig @@ -1,329 +1,327 @@ -The color of its body changes with the water temperature. The coloration of Gorebyss in Alola is almost blindingly vivid. Numel stores magma of almost 2,200 degrees Fahrenheit within its body. If it gets wet, the magma cools and hardens. In that event, the Pokémon’s body grows heavy and its movements become sluggish. Recordings of Jigglypuff’s strange lullabies can be purchased from department stores. These CDs can be found near the bedding area.
- {% embed '@cloudfour/objects/rhythm/rhythm.twig' with { - class: 'o-rhythm--default o-rhythm--generous-headings' } %} - {% block content %} +Rapidash usually can be seen casually cantering in the fields and plains. However, when this Pokémon turns serious, its fiery manes flare and blaze as it gallops its way up to 150 mph. Individuals that have been set free by Trainers who could no longer raise them have become common, and they can now be found in Alola. When the bacteria living inside its antennae absorb Lanturn’s bodily fluids, a strong luminescent effect is produced.
+The color of its body changes with the water temperature. The coloration of Gorebyss in Alola is almost blindingly vivid. Numel stores magma of almost 2,200 degrees Fahrenheit within its body. If it gets wet, the magma cools and hardens. In that event, the Pokémon’s body grows heavy and its movements become sluggish. Recordings of Jigglypuff’s strange lullabies can be purchased from department stores. These CDs can be found near the bedding area.
+If Donphan were to tackle with its hard body, even a house could be destroyed. Using its massive strength, the Pokémon helps clear rock and mud slides that block mountain trails.Ralts has the ability to sense the emotions of people. If its Trainer is in a cheerful mood, this Pokémon grows cheerful and joyous in the same way.Rhyhorn’s brain is very small. It is so dense, while on a run it forgets why it started running in the first place. It apparently remembers sometimes if it demolishes something.
-Rapidash usually can be seen casually cantering in the fields and plains. However, when this Pokémon turns serious, its fiery manes flare and blaze as it gallops its way up to 150 mph. Individuals that have been set free by Trainers who could no longer raise them have become common, and they can now be found in Alola. When the bacteria living inside its antennae absorb Lanturn’s bodily fluids, a strong luminescent effect is produced.
+ {% include '@cloudfour/components/heading/heading.twig' with { + level: 2, + content: 'To Be or Not to Be?', + permalink: true + } only %} -If Donphan were to tackle with its hard body, even a house could be destroyed. Using its massive strength, the Pokémon helps clear rock and mud slides that block mountain trails.Ralts has the ability to sense the emotions of people. If its Trainer is in a cheerful mood, this Pokémon grows cheerful and joyous in the same way.Rhyhorn’s brain is very small. It is so dense, while on a run it forgets why it started running in the first place. It apparently remembers sometimes if it demolishes something.
+Its two sharp scythes are more than just weapons. It uses them with dexterity to dress its prey before eating. Shuckle quietly hides itself under rocks, keeping its body concealed inside its hard shell while eating berries it has stored away. The berries mix with its body fluids to become a juice. Motionless, it hangs from trees, waiting for its bug Pokémon prey to come to it. Its favorite in Alola is Cutiefly.
- {% include '@cloudfour/components/heading/heading.twig' with { - level: 2, - content: 'To Be or Not to Be?', - permalink: true - } only %} ++-CSS Grid Layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives.
+Like tables, grid layout enables an author to align elements into columns and rows. However, many more layouts are either possible or easier with CSS grid than they were with tables. For example, a grid container's child elements could position themselves so they actually overlap and layer, similar to CSS positioned elements.
+ +
Its two sharp scythes are more than just weapons. It uses them with dexterity to dress its prey before eating. Shuckle quietly hides itself under rocks, keeping its body concealed inside its hard shell while eating berries it has stored away. The berries mix with its body fluids to become a juice. Motionless, it hangs from trees, waiting for its bug Pokémon prey to come to it. Its favorite in Alola is Cutiefly.
+The only thing unlucky about Absol is its appearance. It protects fields and warns people of disaster, so one ought to be grateful for it.It can be spotted near recreational facilities, intending to eat the pleasant dreams of children who enjoyed themselves there that day.
--+ {% include '@cloudfour/components/heading/heading.twig' with { + level: 2, + content: 'Yellow Submarine in Pepperland', + permalink: true + } only %} -CSS Grid Layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives.
-Like tables, grid layout enables an author to align elements into columns and rows. However, many more layouts are either possible or easier with CSS grid than they were with tables. For example, a grid container's child elements could position themselves so they actually overlap and layer, similar to CSS positioned elements.
- -
The only thing unlucky about Absol is its appearance. It protects fields and warns people of disaster, so one ought to be grateful for it.It can be spotted near recreational facilities, intending to eat the pleasant dreams of children who enjoyed themselves there that day.
+There are some places where Slowpoke is worshiped because of a long-standing belief that whenever Slowpoke yawns, it rains. Carrying food through Fearow’s territory is dangerous. It will snatch the food away from you in a flash! Oddish searches for fertile, nutrient-rich soil, then plants itself. During the daytime, while it is planted, this Pokémon’s feet are thought to change shape and become similar to the roots of trees.
There are some places where Slowpoke is worshiped because of a long-standing belief that whenever Slowpoke yawns, it rains. Carrying food through Fearow’s territory is dangerous. It will snatch the food away from you in a flash! Oddish searches for fertile, nutrient-rich soil, then plants itself. During the daytime, while it is planted, this Pokémon’s feet are thought to change shape and become similar to the roots of trees.
In the distant past, they were fairly strong, but they have become gradually weaker over time. Although known for their splendid tail fins, Goldeen apparently compete among themselves to see whose horn is thickest and sharpest. Beautifly has a long mouth like a coiled needle, which is very convenient for collecting pollen from flowers. This Pokémon rides the spring winds as it flits around gathering pollen.
- {% include '@cloudfour/design/typography/demo/code-block.twig' only %} - -In the distant past, they were fairly strong, but they have become gradually weaker over time. Although known for their splendid tail fins, Goldeen apparently compete among themselves to see whose horn is thickest and sharpest. Beautifly has a long mouth like a coiled needle, which is very convenient for collecting pollen from flowers. This Pokémon rides the spring winds as it flits around gathering pollen.
- - {% include '@cloudfour/objects/list/list.twig' with { - "items": [ - "Design Tokens", - "Objects", - "Components", - "Scope", - "Utilities", - "Themes" - ], - "tag_name": "ul" - } only %} + {% include '@cloudfour/objects/list/list.twig' with { + "items": [ + "Design Tokens", + "Objects", + "Components", + "Scope", + "Utilities", + "Themes" + ], + "tag_name": "ul" + } only %} -Its tail is large and covered with a rich, thick fur. The tail becomes increasingly deeper in color as Wartortle ages. The scratches on its shell are evidence of this Pokémon’s toughness as a battler. Lombre’s entire body is covered by a slippery, slimy film.
- {% endblock %} - {% endembed %} +Its tail is large and covered with a rich, thick fur. The tail becomes increasingly deeper in color as Wartortle ages. The scratches on its shell are evidence of this Pokémon’s toughness as a battler. Lombre’s entire body is covered by a slippery, slimy film.
+ {% endblock %} + {% endembed %} - {% embed '@cloudfour/components/card/card.twig' with { - href: '#', - class: ' c-card--contained bio-card' - } only %} - {% block content %} + {% embed '@cloudfour/components/card/card.twig' with { + href: '#', + class: 'c-card--contained o-container__fill-pad' + } only %} + {% block content %} - {% embed '@cloudfour/objects/media/media.twig' with { - reverse: true - } only %} - {% block object %} - {% include '@cloudfour/components/avatar/avatar.twig' with { - src: 'media/team-avatars/aileen.png' - } only %} - {% endblock %} - {% block content %} -Aileen Jeffries Magna ea anim duis fugiat sit labore labore sit nisi eiusmod in consectetur duis id. Aliqua commodo aliqua do fugiat labore consectetur cillum exercitation. Quis do magna and adipisicing.
- {% endblock %} - {% endembed %} - {% endblock %} - {% endembed %} + {% embed '@cloudfour/objects/media/media.twig' with { + reverse: true + } only %} + {% block object %} + {% include '@cloudfour/components/avatar/avatar.twig' with { + src: 'media/team-avatars/aileen.png' + } only %} + {% endblock %} + {% block content %} +Aileen Jeffries Magna ea anim duis fugiat sit labore labore sit nisi eiusmod in consectetur duis id. Aliqua commodo aliqua do fugiat labore consectetur cillum exercitation. Quis do magna and adipisicing.
+ {% endblock %} + {% endembed %} + {% endblock %} + {% endembed %} - {% include '@cloudfour/components/heading/heading.twig' with { - level: 2, - content: 'Comments' - } only %} + {% include '@cloudfour/components/heading/heading.twig' with { + level: 2, + content: 'Comments' + } only %} - {% include '@cloudfour/components/comment/comment.twig' with { - "comment": { - "ID": "217", - "link": "#comment-217", - "date": "2021-08-05T21:48:51.435Z", - "avatar": "https://placeimg.com/92/92/people", - "author": { - "name": "Duruzit Lidofideh" + {% include '@cloudfour/components/comment/comment.twig' with { + "comment": { + "ID": "217", + "link": "#comment-217", + "date": "2021-08-05T21:48:51.435Z", + "avatar": "https://placeimg.com/92/92/people", + "author": { + "name": "Duruzit Lidofideh" + }, + "comment_content": "Design system talk repository UX sufficient contrast go input loxe. Ri accessible UX theming web standards lepaxenuti yab mockups nikil font-loading yitobubugo testing.
Pacirec Progressive Web App (PWA) lapohoba Progressive Web App (PWA) talk adaptive fa. Service worker accessibility prototype progressive enhancement responsive issue rayapeded ju experience agile kiwed rojomabod sufficient contrast hezeqotilo talk puboj community intuitive buce. Ru. SVG repository.
", + "is_child": false, + "children": [ + { + "ID": "218", + "link": "#comment-218", + "date": "2021-08-05T21:48:51.436Z", + "avatar": "https://placeimg.com/92/92/animals", + "author": { + "name": "Rar Bopuma" + }, + "comment_content": "Tipiqi preload audience givob sirabino readable testing agile. Dimo coca benulob.
Fallback. Animation multidisciplinary kimob. Zegidutace automate mapateroni. Case study fallback hih cukirip issue polyfill. Web standards picture element input testing sketching.
Design system talk repository UX sufficient contrast go input loxe. Ri accessible UX theming web standards lepaxenuti yab mockups nikil font-loading yitobubugo testing.
Pacirec Progressive Web App (PWA) lapohoba Progressive Web App (PWA) talk adaptive fa. Service worker accessibility prototype progressive enhancement responsive issue rayapeded ju experience agile kiwed rojomabod sufficient contrast hezeqotilo talk puboj community intuitive buce. Ru. SVG repository.
", - "is_child": false, - "children": [ - { - "ID": "218", - "link": "#comment-218", - "date": "2021-08-05T21:48:51.436Z", - "avatar": "https://placeimg.com/92/92/animals", - "author": { - "name": "Rar Bopuma" - }, - "comment_content": "Tipiqi preload audience givob sirabino readable testing agile. Dimo coca benulob.
Fallback. Animation multidisciplinary kimob. Zegidutace automate mapateroni. Case study fallback hih cukirip issue polyfill. Web standards picture element input testing sketching.
Performance fodorebipi automate ceror sufficient contrast picture element multidisciplinary mockups input JavaScript. Cross-disciplinary be agile readable usability hunu. Specification UX specification. Audience reri cul dutohey. Jicidurok hat accessibility thank you celinob.
This article rubuhamot pe design token HTTP/2 tit. Baroga tubilimil. Web app cilodob prototype theming picture element ropup service worker mib mol HTML bu SVG issue..
Performance fodorebipi automate ceror sufficient contrast picture element multidisciplinary mockups input JavaScript. Cross-disciplinary be agile readable usability hunu. Specification UX specification. Audience reri cul dutohey. Jicidurok hat accessibility thank you celinob.
This article rubuhamot pe design token HTTP/2 tit. Baroga tubilimil. Web app cilodob prototype theming picture element ropup service worker mib mol HTML bu SVG issue..
Audience TL;DR. Typography deploy da mockups transparency SVG raxakarod lil bo accessibility padulid multidisciplinary input rulop service worker sticky notes this article experience dukiborebo rubuni tamapiroru theming UX lobi TL;DR. Dependency hobino.
", - "is_child": false, - "children": [], - "approved": true - } - } only %} + {% include '@cloudfour/components/comment/comment.twig' with { + "comment": { + "ID": "213", + "link": "#comment-213", + "date": "2021-08-05T21:48:51.435Z", + "avatar": "https://placeimg.com/92/92/tech", + "author": { + "name": "Wuse Zelu" + }, + "comment_content": "Audience TL;DR. Typography deploy da mockups transparency SVG raxakarod lil bo accessibility padulid multidisciplinary input rulop service worker sticky notes this article experience dukiborebo rubuni tamapiroru theming UX lobi TL;DR. Dependency hobino.
", + "is_child": false, + "children": [], + "approved": true + } + } only %} - {% include '@cloudfour/components/comment-form/comment-form.twig' with { - "heading_id": "leave-a-comment", - "help_text_id": "leave-a-comment-help-text" - } only %} + {% include '@cloudfour/components/comment-form/comment-form.twig' with { + "heading_id": "leave-a-comment", + "help_text_id": "leave-a-comment-help-text" + } only %} - {% endblock %} - {% endembed %} - {% endblock %} - {% endembed %} - {% include '@cloudfour/components/ground-nav/ground-nav.twig' with { - "menu": { - "items": [ - { - "link": "/does", - "title": "What We Do", - "current": true - }, - { - "link": "/believes", - "title": "Our Approach" - }, - { - "link": "/made", - "title": "Our Work" - }, - { - "link": "/thinks", - "title": "Articles" - }, - { - "link": "/presents", - "title": "Speaking" - }, - { - "link": "/contributes", - "title": "Labs" - }, - { - "link": "/is", - "title": "Team" - }, - { - "link": "/portland-device-lab", - "title": "Device Lab" - }, - { - "link": "https://cloudfour-patterns.netlify.app/", - "title": "Patterns" - }, - { - "link": "https://www.responsivefieldday.com/", - "title": "Responsive Field Day" - } - ] - }, - "social": { - "items": [ - { - "link": "https://twitter.com/cloudfour", - "title": "Follow us on Twitter", - "icon": "brands/twitter" - }, - { - "link": "https://github.com/cloudfour", - "title": "Find us on GitHub", - "icon": "brands/github" - }, - { - "link": "https://www.instagram.com/cloudfourpdx/", - "title": "Follow us on Instagram", - "icon": "brands/instagram" - }, - { - "link": "https://www.linkedin.com/company/cloud-four", - "title": "Follow us on LinkedIn", - "icon": "brands/linkedin" - } - ] - }, - "action": { - "lead_in": "Let’s discuss your project!", - "title": "Email us", - "link": "mailto:info@cloudfour.com", - "icon": "envelope" - }, - "organization": { - "name": "Cloud Four, Inc.", - "address": { - "street_address": "510 SW 3rd Ave, Suite 420", - "address_locality": "Portland", - "address_region": "Oregon", - "postal_code": "97204", - "address_country": "USA" + {% endblock %} + {% endembed %} + {% endblock %} +{% endembed %} +{% include '@cloudfour/components/ground-nav/ground-nav.twig' with { + "menu": { + "items": [ + { + "link": "/does", + "title": "What We Do", + "current": true }, - "email": "info@cloudfour.com", - "telephone": "+1 (503) 290-1090", - "url": "https://cloudfour.com/", - "founding_date": "2007-12-13" - } - } only %} -