-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathstyle.scss
190 lines (166 loc) · 4.46 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Import styles for rendering the static content of deprecated gallery versions.
@import "./deprecated.scss";
// The following is a temporary override until flex layout supports
// an align items setting of normal.
figure.wp-block-gallery.has-nested-images {
align-items: normal;
}
// Styles for current version of gallery block.
.wp-block-gallery.has-nested-images {
// Need bogus :not(#individual-image) to override long :not()
// specificity chain on default image block on front end.
figure.wp-block-image:not(#individual-image) {
width: calc(50% - (var(--wp--style--unstable-gallery-gap, #{$grid-unit-20}) / 2));
margin: 0;
}
figure.wp-block-image {
display: flex;
flex-grow: 1;
justify-content: center;
position: relative;
flex-direction: column;
max-width: 100%;
// Prevents theme.json and global styles borders that apply to the outer
// wrapper from incorrectly enlarging gallery images to a point they
// result in a single column gallery.
box-sizing: border-box;
> div,
> a {
margin: 0;
flex-direction: column;
flex-grow: 1;
}
img {
display: block;
height: auto;
// Ensure max-width is not overridden on the img when the parent gallery has
// wide or full alignment.
max-width: 100% !important;
width: auto;
}
// Position caption and scrim at the bottom.
&:has(figcaption)::before,
figcaption {
position: absolute;
bottom: 0;
right: 0;
left: 0;
max-height: 100%;
}
// Create a background blur layer.
&:has(figcaption)::before {
content: "";
height: 100%;
max-height: 40%;
// Blur the background under the gradient scrim.
backdrop-filter: blur(3px);
// Crop the caption so the blur is only on the edge.
mask-image: linear-gradient(0deg, $black 20%, transparent 100%);
}
// Place the caption at the bottom.
figcaption {
color: $white;
text-shadow: 0 0 1.5px $black;
font-size: $default-font-size;
margin: 0;
overflow: auto;
padding: 1em;
text-align: center;
box-sizing: border-box;
@include custom-scrollbars-on-hover(transparent, rgba($white, 0.8));
// Dark gradient scrim.
background: linear-gradient(0deg, rgba($color: $black, $alpha: 0.4) 0%, transparent 100%);
img {
display: inline;
}
a {
color: inherit;
}
}
&.has-custom-border img {
box-sizing: border-box;
}
&.is-style-rounded,
&.has-custom-border {
> div,
> a {
flex: 1 1 auto;
}
figcaption {
flex: initial;
background: none;
color: inherit;
margin: 0;
padding: 10px 10px 9px;
position: relative;
text-shadow: none;
}
&::before {
content: none;
}
}
}
figcaption {
flex-grow: 1;
flex-basis: 100%;
text-align: center;
}
// Non cropped images.
&:not(.is-cropped) {
figure.wp-block-image:not(#individual-image) {
margin-top: 0;
margin-bottom: auto;
}
}
// Cropped Images.
&.is-cropped figure.wp-block-image:not(#individual-image) {
align-self: inherit;
> div:not(.components-drop-zone),
> a {
display: flex;
}
a,
img {
width: 100%;
flex: 1 0 0%;
height: 100%;
object-fit: cover;
}
}
&.columns-1 figure.wp-block-image:not(#individual-image) {
width: 100%;
}
// Beyond mobile viewports, we allow up to 8 columns.
@include break-small {
@for $i from 3 through 8 {
&.columns-#{ $i } figure.wp-block-image:not(#individual-image) {
width: calc(#{math.div(100%, $i)} - (var(--wp--style--unstable-gallery-gap, #{$grid-unit-20}) * #{math.div($i - 1, $i)}));
}
}
// If number of columns not explicitly set default to 3 columns if 3 or more images.
&.columns-default {
figure.wp-block-image:not(#individual-image) {
width: calc(33.33% - (var(--wp--style--unstable-gallery-gap, 16px) * #{math.div(2, 3)}));
}
// If only 2 child images use 2 columns.
figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2),
figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2) ~ figure.wp-block-image:not(#individual-image) {
width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.5));
}
// For a single image set to 100%.
figure.wp-block-image:not(#individual-image):first-child:nth-last-child(1) {
width: 100%;
}
}
}
// Apply max-width to floated items that have no intrinsic width.
&.alignleft,
&.alignright {
max-width: $content-width * 0.5;
width: 100%;
}
// If the gallery is centered, center the content inside as well.
&.aligncenter {
justify-content: center;
}
}