Skip to content

Commit a871faa

Browse files
authored
Add wp-block-video alignment options (#1930)
1 parent bac89ee commit a871faa

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

.changeset/smooth-owls-try.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': minor
3+
---
4+
5+
Make default, center, full and wide alignment options consistent between WordPress image and video blocks

src/vendor/wordpress/demo/alignment.twig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
{% if extra_div %}
3636
</div>
3737
{% endif %}
38+
<p>
39+
Another ordinary paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at sapien porttitor risus blandit posuere. Sed in malesuada ligula. Nam vulputate metus sed nibh vulputate, sed varius neque tincidunt.
40+
</p>
41+
<figure class="wp-block-video {{alignment}}">
42+
<video controls src="/media/waterfall_edit.mp4"></video>
43+
<figcaption>This WordPress Video Block with a caption has <b>{{alignment|default('no')|replace({'align': ''})}} alignment</b>!</figcaption>
44+
</figure>
3845
<p>
3946
One more ordinary paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at sapien porttitor risus blandit posuere. Sed in malesuada ligula. Nam vulputate metus sed nibh vulputate, sed varius neque tincidunt.
4047
</p>

src/vendor/wordpress/styles/_core-blocks.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,20 @@ figure.wp-block-image {
174174
}
175175
}
176176

177+
/// Gutenberg block: Video
178+
/// Styles for videos inserted via Gutenberg blocks.
179+
.wp-block-video {
180+
&:not(.alignwide, .alignfull, .aligncenter) {
181+
@include spacing.fluid-margin-inline-negative;
182+
}
183+
184+
&:not(.aligncenter) {
185+
figcaption {
186+
@include spacing.fluid-padding-inline;
187+
}
188+
}
189+
}
190+
177191
/**
178192
* Gutenberg block: Table
179193
* Applies our pattern library styles to tables generated via Gutenberg blocks.

src/vendor/wordpress/utilities.stories.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ We include `has-{font-size}-font-size` classes for our `big`, `small` and headin
8787

8888
By default, blocks with backgrounds and image blocks will attempt to fill the available inline padding of [our containers](/docs/objects-container--basic). You can opt into different alignment options for certain blocks.
8989

90-
| WordPress Class | Behavior | Blocks |
91-
| --------------- | ----------------------------------------- | ------------------------------------------ |
92-
| (None) | Fill available inline padding | Code, Image, blocks with background colors |
93-
| `aligncenter` | Stay within the container (do not fill) | Image, blocks with background colors |
94-
| `alignleft` | Float left, constrain inline size | Image |
95-
| `alignright` | Float right, constrain inline size | Image |
96-
| `alignfull` | Fill viewport inline size | Blocks with alignment options |
97-
| `alignwide` | Fill viewport inline size up to a maximum | Blocks with alignment options |
90+
| WordPress Class | Behavior | Blocks |
91+
| --------------- | ----------------------------------------- | ------------------------------------------------- |
92+
| (None) | Fill available inline padding | Code, Image, Video, blocks with background colors |
93+
| `aligncenter` | Stay within the container (do not fill) | Image, Video, blocks with background colors |
94+
| `alignleft` | Float left, constrain inline size | Image |
95+
| `alignright` | Float right, constrain inline size | Image |
96+
| `alignfull` | Fill viewport inline size | Blocks with alignment options |
97+
| `alignwide` | Fill viewport inline size up to a maximum | Blocks with alignment options |
9898

9999
<Canvas>
100100
<Story

0 commit comments

Comments
 (0)