PluginProbe
Code Snippets / trunk
Code Snippets vtrunk
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
code-snippets / css / manage / _snippets-table.scss

_snippets-table.scss in Code Snippets trunk, at css/manage/_snippets-table.scss

374 lines 8.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 @use '../common/badges';
2 @use '../common/list-table';
3 @use '../common/theme';
4
5 .column-name,
6 .column-type {
7 .dashicons {
8 font-size: 16px;
9 inline-size: 16px;
10 block-size: 16px;
11 vertical-align: middle;
12 }
13
14 .dashicons-clock {
15 vertical-align: middle;
16 }
17 }
18
19 // `.wp-list-table` prefix keeps this above WP 7.0's 40px control height so the boxed
20 // priority field stays 30px tall (below the 38px control token, which would stretch the
21 // table rows) and vertically aligned with the rest of the row.
22 .wp-list-table .priority-column input {
23 appearance: none;
24 background: var(--cs-color-surface);
25 border: 1px solid var(--cs-color-border);
26 border-radius: 5px;
27 box-shadow: none;
28 box-sizing: border-box;
29 min-block-size: 30px;
30 block-size: 30px;
31 inline-size: 4em;
32
33 // Pin the box model so padding/margins/line-height match WP 6.9 regardless of WP 7.0's
34 // taller default control metrics; this keeps the value aligned in both the resting and
35 // hovered (native spinner) states.
36 padding-block: 0;
37 padding-inline: 8px;
38 margin-block: 0;
39 margin-inline: 1px;
40 line-height: 2;
41 color: var(--cs-color-text);
42 text-align: center;
43
44 &:disabled {
45 color: inherit;
46 }
47
48 &:hover, &:focus, &:active {
49 color: var(--cs-color-text);
50 border-radius: 5px;
51 appearance: unset;
52 box-shadow: none;
53 outline: 2px solid var(--cs-color-accent);
54
55 &:disabled {
56 color: inherit;
57 background-color: transparent;
58 }
59 }
60 }
61
62 .wp-list-table .is-expanded td.column-activate.activate {
63 /* fix for mobile layout */
64 display: table-cell !important;
65 }
66
67 .snippet-name-group {
68 display: inline-flex;
69 align-items: center;
70 gap: 6px;
71 max-inline-size: 100%;
72 min-inline-size: 0;
73
74 .snippet-name {
75 min-inline-size: 0;
76 overflow: hidden;
77 text-overflow: ellipsis;
78 white-space: nowrap;
79 }
80
81 .badge {
82 flex-shrink: 0;
83 }
84 }
85
86 .snippet-secure-status {
87 display: inline-flex;
88 align-items: center;
89 block-size: 24px;
90 box-sizing: border-box;
91 flex: 0 0 auto;
92 vertical-align: top;
93
94 .tooltip-trigger {
95 align-items: center;
96 justify-content: center;
97 inline-size: 24px;
98 block-size: 24px;
99 background: #cbf2d3;
100 border: 1px solid #a9d5b2;
101 border-radius: 5px;
102 color: #1a7f37;
103
104 svg {
105 display: block;
106 }
107 }
108 }
109
110 .snippets-card-grid {
111 // Three equal-height cards per row; descriptions are clamped so height
112 // stays uniform regardless of text length. The compound selector wins
113 // over the base .code-snippets-cards auto-fill column rule, which is
114 // emitted later in the compiled stylesheet.
115 // minmax(0, 1fr) lets tracks shrink below their content's min-content
116 // width (wide footer button rows), which plain 1fr tracks cannot,
117 // preventing the grid from overflowing the page horizontally.
118 &.code-snippets-cards {
119 grid-template-columns: repeat(3, minmax(0, 1fr));
120
121 @media (width <= 1100px) {
122 grid-template-columns: repeat(2, minmax(0, 1fr));
123 }
124
125 @media (width <= 782px) {
126 grid-template-columns: minmax(0, 1fr);
127 }
128 }
129
130 .code-snippets-card {
131 min-inline-size: 0;
132 }
133
134 // Reveal the bulk-select checkbox on hover or keyboard focus, and keep
135 // every checkbox visible while any card in the grid is selected so an
136 // in-progress selection is never hidden.
137 .snippet-card-select {
138 opacity: 0;
139 transition: opacity 0.15s ease;
140
141 @media (prefers-reduced-motion: reduce) {
142 transition-duration: 0.01s;
143 }
144 }
145
146 .snippet-card-select:checked,
147 &.has-selection .snippet-card-select,
148 .code-snippets-card:hover .snippet-card-select,
149 .code-snippets-card:focus-within .snippet-card-select {
150 opacity: 1;
151 }
152
153 // Card body bands: header row, meta row, then a separated description.
154 .card-inner {
155 display: flex;
156 flex-flow: column;
157 gap: 16px;
158 }
159
160 .snippet-card-header {
161 display: flex;
162 align-items: center;
163 gap: 10px;
164
165 // Insights pills close out this row, so allow wrapping: on a narrow card
166 // they drop to a line of their own rather than squeezing the name away.
167 flex-wrap: wrap;
168
169 // Keep header content clear of the absolutely-positioned selection checkbox.
170 padding-inline-end: 32px;
171
172 > a {
173 display: inline-flex;
174 border-radius: 5px;
175
176 &:focus,
177 &:focus-visible {
178 outline: none;
179 box-shadow: 0 0 0 2px var(--cs-color-surface), 0 0 0 4px var(--cs-color-accent);
180 }
181 }
182
183 // Insights pills close out the header row, sitting directly below the
184 // selection checkbox in the card corner. End-aligning them in flow means
185 // the header never has to reserve a fixed gutter for a variable-width
186 // group — the heading absorbs the shrink down to its floor, and past
187 // that the pills wrap instead.
188 .cs-insights-trigger {
189 margin-inline-start: auto;
190 flex-wrap: nowrap;
191 flex-shrink: 0;
192 }
193
194 h3 {
195 margin: 0;
196 font-size: 18px;
197 font-weight: 700;
198 line-height: 1.5;
199
200 // Zero basis, not auto: with a wrapping flex row, line-breaking uses
201 // each item's content width before any shrinking, so an auto-basis
202 // heading would break to its own line whenever the name is long.
203 // A zero basis keeps it on the first line and grows into the slack.
204 flex: 1 1 0;
205
206 // Let the heading shrink inside the flex row so long names truncate
207 // instead of pushing the header icons out of the card — but not below
208 // a readable stub, or a card with pills shows no name at all.
209 min-inline-size: 9ch;
210
211 .snippet-name {
212 color: var(--cs-color-accent);
213 text-decoration: none;
214 }
215
216 .snippet-name-group {
217 display: flex;
218 inline-size: 100%;
219 }
220 }
221
222 .extra-icons:empty {
223 display: none;
224 }
225
226 // The accent pill styling lives in common/_switch.scss; keep the
227 // switch from shrinking inside the flex card header.
228 input[type='checkbox']='checkbox'].switch {
229 flex-shrink: 0;
230 }
231 }
232
233 .snippet-card-meta {
234 display: flex;
235 align-items: center;
236 flex-wrap: wrap;
237 gap: 8px;
238 font-size: 14px;
239 line-height: 1.5;
240 border-block-end: 1px solid var(--cs-color-border-subtle);
241 padding-block-end: 16px;
242
243 .snippet-card-statuses {
244 display: inline-flex;
245 align-items: center;
246 block-size: 24px;
247 box-sizing: border-box;
248 gap: 4px;
249 flex-shrink: 0;
250
251 > .cs-insights-statuses,
252 > .cs-insights-statuses > .cs-insights-trigger {
253 display: inline-flex;
254 align-items: center;
255 block-size: 24px;
256 box-sizing: border-box;
257 }
258 }
259
260 .snippet-card-tags-label {
261 color: var(--cs-color-text-muted);
262 }
263
264 .snippet-card-tags a {
265 color: var(--cs-color-accent);
266 text-decoration: none;
267
268 &:focus {
269 box-shadow: none;
270 }
271
272 &:focus-visible {
273 outline: 2px solid var(--cs-color-accent);
274 }
275 }
276
277 .snippet-card-modified {
278 color: var(--cs-color-text-muted);
279 }
280
281 &.has-tags .snippet-card-modified {
282 margin-inline-start: auto;
283 }
284 }
285
286 .snippet-description-content {
287 display: -webkit-box;
288 -webkit-box-orient: vertical;
289 -webkit-line-clamp: 2;
290 line-clamp: 2;
291 overflow: hidden;
292 font-size: 14px;
293 line-height: 1.5;
294 color: var(--cs-color-text-muted);
295 }
296
297 // Align the selection checkbox with the taller card header row, so its top
298 // edge matches the insights pills sharing that row.
299 // Qualified with .code-snippets-card to outrank the base
300 // `.code-snippets-card .snippet-card-corner` rule in common/_cards.scss,
301 // which has equal specificity but is emitted later.
302 .code-snippets-card .snippet-card-corner {
303 inset-block-start: 27px;
304 }
305
306 .code-snippets-card footer {
307 .button {
308 font-size: 14px;
309 line-height: 2.5714;
310 border-radius: 5px;
311 }
312
313 .button:not(.button-primary) {
314 background: transparent;
315 }
316 }
317
318 .kebab-menu-priority {
319 justify-content: space-between;
320
321 // Balances the shorter input so the row matches the height of the menu
322 // items above and below it.
323 padding-block: 5px;
324
325 input.snippet-priority {
326 inline-size: 52px;
327 block-size: 30px;
328
329 // WordPress sizes number inputs with a min-height, which would
330 // otherwise win over the height set here.
331 min-block-size: 0;
332 box-sizing: border-box;
333 margin: 0;
334 padding-block: 0;
335 padding-inline: 4px;
336 border: 1px solid var(--cs-color-border-subtle);
337 border-radius: 5px;
338 text-align: center;
339 color: var(--cs-color-text);
340 }
341 }
342 }
343
344 // Shared table-navigation layout for both snippet views and both toolbars:
345 // bulk actions, select all, tag filter and search on the left, with the item
346 // count, pagination and view toggle pinned to the far end of the row. The
347 // bottom toolbar repeats only the bulk actions and pagination group.
348 .snippets-list-view .tablenav {
349 block-size: auto;
350 margin-block-end: 16px;
351 }
352
353 .snippets-search-subtitle {
354 margin-block: 0 12px;
355 font-size: 14px;
356 font-style: italic;
357 color: var(--cs-color-text-muted);
358 text-align: center;
359 display: flex;
360 align-items: center;
361 justify-content: center;
362 gap: 1em;
363 }
364
365 // Keep every table row the same height by clamping the description cell
366 // to two lines, matching the two-line name + row-actions column.
367 .snippets-list-view .wp-list-table td.column-desc .snippet-description-content {
368 display: -webkit-box;
369 -webkit-box-orient: vertical;
370 -webkit-line-clamp: 2;
371 line-clamp: 2;
372 overflow: hidden;
373 }
374