Skip to content

Commit f27b66e

Browse files
authored
Revise blockquote-derived styles (#2176)
1 parent 1ba95bc commit f27b66e

File tree

8 files changed

+212
-139
lines changed

8 files changed

+212
-139
lines changed

.changeset/tame-geese-provide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': major
3+
---
4+
5+
Revised `blockquote` and WordPress Quote and Pullquote block styles to address issues of consistency and improve feature support. Content that relied on previous quote styles may need to be reviewed or updated.

src/base/_defaults.scss

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
@use '../compiled/tokens/scss/color';
33
@use '../compiled/tokens/scss/size';
44
@use '../mixins/border-radius';
5+
@use '../mixins/emdash';
56
@use '../mixins/ms';
7+
@use '../mixins/spacing';
68
@use '../mixins/theme';
79

810
/**
@@ -235,15 +237,25 @@ blockquote {
235237
padding-inline-start: size.$spacing-type-block-indent;
236238
}
237239

238-
/**
239-
* Adjacent children of blockquotes should include some default vertical rhythm.
240-
* We use the same design token as the `o-rhythm` pattern for consistency.
241-
*
242-
* @see https://alistapart.com/article/axiomatic-css-and-lobotomized-owls/
243-
*/
240+
blockquote {
241+
@include spacing.vertical-rhythm;
242+
border-inline-start: size.$border-width-blockquote solid
243+
var(--theme-color-border-text-group);
244+
color: var(--theme-color-text-muted);
245+
}
244246

245-
blockquote > * + * {
246-
margin-block-start: size.$rhythm-default;
247+
blockquote > cite,
248+
blockquote > footer > cite {
249+
display: block;
250+
font-style: inherit;
251+
padding-inline-start: size.$spacing-type-block-indent;
252+
position: relative;
253+
254+
&::before {
255+
@include emdash.content;
256+
inset-inline-start: 0;
257+
position: absolute;
258+
}
247259
}
248260

249261
/**

src/components/comment/comment.scss

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
@use '../../compiled/tokens/scss/color';
33
@use '../../compiled/tokens/scss/font-weight';
44
@use '../../compiled/tokens/scss/size';
5-
@use '../../mixins/emdash';
65
@use '../../mixins/headings';
76
@use '../../mixins/theme';
87

@@ -78,24 +77,6 @@
7877
min-inline-size: 0; // 2
7978
}
8079

81-
// We added default styles to the blockquote element using the `wp-block-quote`
82-
// class. We're applying those same styles here, so comment blockquotes look
83-
// the similar.
84-
85-
.c-comment__content blockquote {
86-
border-inline-start: size.$border-width-blockquote solid
87-
var(--theme-color-border-kbd);
88-
color: var(--theme-color-text-muted);
89-
}
90-
91-
.c-comment__content blockquote cite {
92-
font-style: normal;
93-
}
94-
95-
.c-comment__content blockquote cite::before {
96-
@include emdash.content;
97-
}
98-
9980
.c-comment__footer {
10081
grid-area: footer;
10182
}

src/vendor/wordpress/core-blocks.stories.mdx

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import blockEmbedYouTubeDemo from './demo/embed/youtube.twig';
55
import blockImageDemo from './demo/image.twig';
66
import blockGroupDemo from './demo/group.twig';
77
import blockMediaTextDemo from './demo/media-text.twig';
8+
import blockQuoteDemo from './demo/quote.twig';
9+
import blockPullQuoteDemo from './demo/pullquote.twig';
810
import blockTableDemo from './demo/table.twig';
911
const blockEmbedDemoArgTypes = {
1012
alignment: {
@@ -531,38 +533,69 @@ class.
531533
</Story>
532534
</Canvas>
533535

534-
## Pullquote
535-
536-
The pullquote block wraps a `blockquote` element in a `figure` element with the class
537-
`wp-block-pullquote`.
536+
## Quote
538537

539-
[Color controls](#color-settings) allow the setting of pre-defined or custom `background-color` and
540-
text `color`. A styles control adds one of two wrapper classes, `is-style-default` or
541-
`is-style-solid-color`. By default, any user-selected `background-color` will be
542-
applied only if the solid color background is toggled on.
538+
The quote block adds a class of `wp-block-quote` directly to a `blockquote` element. It supports background and text colors as well as text alignment, but not general alignment options. It may or may not include a citation.
543539

544540
<Canvas>
545-
<Story name="Pullquote">
546-
{`<figure class="wp-block-pullquote has-background is-style-solid-color">
547-
<blockquote class="has-text-color has-accent-color">
548-
<p>One of the hardest things to do in technology is disrupt yourself.</p>
549-
<cite>Matt Mullenweg</cite>
550-
</blockquote>
551-
</figure>`}
541+
<Story
542+
name="Quote"
543+
args={{
544+
show_citation: true,
545+
has_background: false,
546+
}}
547+
argTypes={{
548+
show_citation: {
549+
control: { type: 'boolean' },
550+
},
551+
style: {
552+
options: ['default', 'plain'],
553+
control: { type: 'select' },
554+
},
555+
has_background: {
556+
control: { type: 'boolean' },
557+
},
558+
text_align: {
559+
options: ['left', 'center', 'right'],
560+
control: { type: 'select' },
561+
},
562+
}}
563+
>
564+
{(args) => blockQuoteDemo(args)}
552565
</Story>
553566
</Canvas>
554567

555-
## Quote
568+
## Pullquote
556569

557-
The quote block adds class of `wp-block-quote` directly to a `blockquote` element.
558-
It has a control to add an optional `is-style-large` class.
570+
The pullquote block wraps a `blockquote` element in a `figure` element with the class
571+
`wp-block-pullquote`.
572+
573+
Its visual appearance is more opinionated than the quote block, and it supports more alignment options (such as floating or breaking out of the containing element).
559574

560575
<Canvas>
561-
<Story name="Quote">
562-
{`<blockquote class="wp-block-quote is-style-large">
563-
<p>In quoting others, we cite ourselves.</p>
564-
<cite>Julio Cortázar</cite>
565-
</blockquote>`}
576+
<Story
577+
name="Pullquote"
578+
parameters={{
579+
layout: 'fullscreen',
580+
}}
581+
args={{
582+
show_citation: true,
583+
}}
584+
argTypes={{
585+
show_citation: {
586+
control: { type: 'boolean' },
587+
},
588+
align: {
589+
options: ['left', 'right', 'wide', 'full'],
590+
control: { type: 'select' },
591+
},
592+
text_align: {
593+
options: ['left', 'center', 'right'],
594+
control: { type: 'select' },
595+
},
596+
}}
597+
>
598+
{(args) => blockPullQuoteDemo(args)}
566599
</Story>
567600
</Canvas>
568601

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
<div class="o-container o-container--prose o-container--pad">
3+
<div class="o-container__content o-rhythm">
4+
<p>
5+
This content precedes the pullquote. Notice how the pullquote has more margin than usual.
6+
</p>
7+
8+
<figure class="wp-block-pullquote
9+
{% if text_align %}has-text-align-{{text_align}}{% endif %}
10+
{% if align %}align{{align}}{% endif %}">
11+
<blockquote>
12+
<p>In case of conflict, consider users over authors over implementors over specifiers over theoretical purity.</p>
13+
{% if show_citation %}
14+
<cite><a href="https://www.w3.org/TR/html-design-principles/#priority-of-constituencies">HTML Design Principles Priority of Constituencies</a></cite>
15+
{% endif %}
16+
</blockquote>
17+
</figure>
18+
19+
<p>
20+
This content follows the pullquote. Notice how the pullquote has more margin than usual.
21+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
22+
</p>
23+
</div>
24+
</div>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<blockquote class="
2+
wp-block-quote
3+
{% if style %}is-style-{{style}}{% endif %}
4+
{% if text_align %}has-text-align-{{text_align}}{% endif %}
5+
{% if has_background %}has-gray-lighter-background-color has-background{% endif %}">
6+
<p><b>CSS Grid Layout</b> 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.</p>
7+
<p>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.</p>
8+
{% if show_citation %}
9+
<cite><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout">MDN Web Docs</a></cite>
10+
{% endif %}
11+
</blockquote>

0 commit comments

Comments
 (0)