Skip to content

Commit 9b04698

Browse files
committed
Add border support to Twenty Twenty-One
1 parent 4dd067f commit 9b04698

5 files changed

Lines changed: 36 additions & 0 deletions

File tree

src/wp-content/themes/twentytwentyone/assets/sass/01-settings/global.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ $baseline-unit: 10px;
200200
--pullquote--color-foreground: var(--global--color-primary);
201201
--pullquote--color-background: var(--global--color-background);
202202

203+
/* Block: Border */
204+
--wp--custom--border--width: 1px;
205+
--wp--custom--border--style: solid;
206+
--wp--custom--border--color: var(--global--color-border);
207+
--wp--custom--border--radius: 0;
208+
203209
--quote--font-family: var(--global--font-secondary);
204210
--quote--font-size: var(--global--font-size-md);
205211
--quote--font-size-large: var(--global--font-size-xl);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Border styles for blocks.
2+
3+
.has-border {
4+
border: var(--wp--custom--border--width, 1px) var(--wp--custom--border--style, solid) var(--wp--custom--border--color, var(--global--color-border));
5+
6+
&.has-border-color {
7+
border-color: var(--wp--custom--border--color);
8+
}
9+
10+
&.has-border-radius {
11+
border-radius: var(--wp--custom--border--radius);
12+
}
13+
}
14+
15+
// Maintaining backward compatibility with legacy border classes.
16+
.has-border-color {
17+
border-color: var(--wp--custom--border--color);
18+
}
19+
20+
.has-border-radius {
21+
border-radius: var(--wp--custom--border--radius);
22+
}

src/wp-content/themes/twentytwentyone/assets/sass/style-dark-mode.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
/* Block: Table */
1616
--table--stripes-border-color: rgba(240, 240, 240, 0.15);
1717
--table--stripes-background-color: rgba(240, 240, 240, 0.15);
18+
19+
/* Block Borders */
20+
--wp--custom--border--color: var(--global--color-border);
1821
}
1922

2023
.is-dark-theme img {

src/wp-content/themes/twentytwentyone/assets/sass/style.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
*
7171
* UTILITIES
7272
* A11y.................Screen reader text, prefers reduced motion etc.
73+
* Border...............Block border styles.
7374
* Color Palette........Classes for the color palette colors.
7475
* Editor Font Sizes....Editor Font Sizes.
7576
* Measure..............The width of a line of text, in characters.
@@ -116,6 +117,7 @@
116117

117118
/* Category 07 is for any utility classes that are not assigned to a specific component. */
118119
@import "07-utilities/a11y";
120+
@import "07-utilities/border";
119121
@import "07-utilities/color-palette";
120122
@import "07-utilities/measure";
121123
@import "07-utilities/ie";

src/wp-content/themes/twentytwentyone/functions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ function twenty_twenty_one_setup() {
334334

335335
// Remove feed icon link from legacy RSS widget.
336336
add_filter( 'rss_widget_feed_link', '__return_empty_string' );
337+
338+
// Add support for block borders.
339+
add_theme_support( 'border' );
337340
}
338341
}
339342
add_action( 'after_setup_theme', 'twenty_twenty_one_setup' );

0 commit comments

Comments
 (0)