-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
style.scss
134 lines (111 loc) · 3.56 KB
/
style.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
.wp-block-columns {
display: flex;
margin-bottom: 1.75em;
box-sizing: border-box;
// Responsiveness: Allow wrapping on mobile.
flex-wrap: wrap;
@include break-medium() {
flex-wrap: nowrap;
}
&:where(.has-background) {
padding: $block-bg-padding--v $block-bg-padding--h;
}
/**
* All Columns Alignment
*/
&.are-vertically-aligned-top {
align-items: flex-start;
}
&.are-vertically-aligned-center {
align-items: center;
}
&.are-vertically-aligned-bottom {
align-items: flex-end;
}
&:not(.is-not-stacked-on-mobile) > .wp-block-column {
@media (max-width: #{ ($break-small - 1) }) {
// Responsiveness: Show at most one columns on mobile. This must be
// important since the Column assigns its own width as an inline style.
flex-basis: 100% !important;
}
// Between mobile and large viewports, allow 2 columns.
@media (min-width: #{ ($break-small) }) and (max-width: #{ ($break-medium - 1) }) {
// Only add two column styling if there are two or more columns
&:not(:only-child) {
// As with mobile styles, this must be important since the Column
// assigns its own width as an inline style, which should take effect
// starting at `break-medium`.
flex-basis: calc(50% - calc(var(--wp--style--block-gap, 2em) / 2)) !important;
flex-grow: 0;
}
// Add space between the multiple columns. Themes can customize this if they wish to work differently.
// Only apply this beyond the mobile breakpoint, as there's only a single column on mobile.
&:nth-child(even) {
margin-left: var(--wp--style--block-gap, 2em);
}
}
// At large viewports, show all columns horizontally.
@include break-medium() {
// Available space should be divided equally amongst columns without an
// assigned width. This is achieved by assigning a flex basis that is
// consistent (equal), would not cause the sum total of column widths to
// exceed 100%, and which would cede to a column with an assigned width.
// The `flex-grow` allows columns to maximally and equally occupy space
// remaining after subtracting the space occupied by columns with
// explicit widths (if any exist).
flex-basis: 0;
flex-grow: 1;
// Columns with an explicitly-assigned width should maintain their
// `flex-basis` width and not grow.
&[style*="flex-basis"] {
flex-grow: 0;
}
// When columns are in a single row, add space before all except the first.
&:not(:first-child) {
margin-left: var(--wp--style--block-gap, 2em);
}
}
}
&.is-not-stacked-on-mobile {
flex-wrap: nowrap;
> .wp-block-column {
// Available space should be divided equally amongst columns.
flex-basis: 0;
flex-grow: 1;
// Columns with an explicitly-assigned width should maintain their
// `flex-basis` width and not grow.
&[style*="flex-basis"] {
flex-grow: 0;
}
// When columns are in a single row, add space before all except the first.
&:not(:first-child) {
margin-left: var(--wp--style--block-gap, 2em);
}
}
}
}
.wp-block-column {
flex-grow: 1;
// Prevent the columns from growing wider than their distributed sizes.
min-width: 0;
// Prevent long unbroken words from overflowing.
word-break: break-word; // For back-compat.
overflow-wrap: break-word; // New standard.
/**
* Individual Column Alignment
*/
&.is-vertically-aligned-top {
align-self: flex-start;
}
&.is-vertically-aligned-center {
align-self: center;
}
&.is-vertically-aligned-bottom {
align-self: flex-end;
}
&.is-vertically-aligned-top,
&.is-vertically-aligned-center,
&.is-vertically-aligned-bottom {
width: 100%;
}
}