PluginProbe
Code Snippets / 3.10.0-beta.2
Code Snippets v3.10.0-beta.2
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 / common / _wp-admin.scss

_wp-admin.scss in Code Snippets 3.10.0-beta.2, at css/common/_wp-admin.scss

186 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 @use 'checkbox';
2 @use 'theme';
3
4 // Match the active subnavigation tile so it blends into the admin canvas.
5 body.wp-admin {
6 background: #f0f0f1;
7 }
8
9 // Remove the WordPress core 10px top margin on the manage snippets container
10 // so the subnav band sits flush against the toolbar.
11 #manage-snippets-container.wrap {
12 margin-block-start: 0;
13 }
14
15 /**
16 * Native form control styling.
17 *
18 * WordPress core ships different control metrics between versions (30/32px classic,
19 * 40px with a 2px radius in the WP 7.0 "modern" redesign) and recolours secondary
20 * buttons with the modern accent (#3858E9). These rules apply the plugin's own control
21 * tokens — 38px height, 5px radius, theme control borders and the brand accent —
22 * to native elements inside our admin pages so the layout renders consistently across
23 * WP versions. They deliberately leave the admin menu, admin bar and
24 * `@wordpress/components` React widgets untouched — only native inputs/buttons
25 * rendered inside our own markup are normalised.
26 */
27
28 // Scope to our admin page content. We intentionally keep this to a single `.wrap` class so
29 // the rules sit just above WordPress core defaults (which we must override) but below the
30 // plugin's own more-specific per-control rules, which are emitted later in each bundle and so
31 // win on equal specificity. This lets bespoke controls (conditions button, row-action links,
32 // priority input, etc.) keep their intended styling without per-element exclusions here.
33 .wrap,
34 // Modals render through a portal on `document.body`, outside the page wrapper, so
35 // the plugin's own dialogs are listed here to pick up the same control tokens.
36 .code-snippets-preview-modal,
37 .code-snippets-modal {
38 // Native single-line text controls and selects: token height + border.
39 // `@wordpress/components` inputs/selects (`.components-*`) keep their own design — they
40 // are excluded so React widgets such as the tags token field are left untouched.
41 // `.snippet-priority` (the borderless list-table priority field) is excluded so it keeps
42 // its plain transparent styling rather than gaining a bordered box.
43 input[type='text']='text']:not([class*='components-'], [id^='react-select-']),
44 input[type='search']='search']:not([class*='components-']),
45 input[type='number']='number']:not([class*='components-'], .snippet-priority),
46 input[type='email']='email']:not([class*='components-']),
47 input[type='url']='url']:not([class*='components-']),
48 input[type='password']='password']:not([class*='components-']),
49 input[type='tel']='tel']:not([class*='components-']) {
50 // `min-block-size` (not a fixed `block-size`) so controls floor at the token height but
51 // can still flex-stretch where the layout calls for it (e.g. the 54px cloud search bar).
52 min-block-size: var(--cs-control-height);
53 padding-block: 0;
54 padding-inline: 8px;
55 border: 1px solid var(--cs-color-border);
56 border-radius: var(--cs-control-radius);
57 line-height: 2;
58 color: var(--cs-color-text);
59 font-size: 14px;
60
61 &:focus {
62 border-color: var(--cs-color-accent);
63 box-shadow: 0 0 0 1px var(--cs-color-accent);
64 outline: 2px solid transparent;
65 }
66 }
67
68 // Selects: same metrics, but preserve room for the WP dropdown chevron on the inline-end
69 // side. WP 7.0 keeps the chevron as a background image; clamping both paddings to 8px (as
70 // for text inputs) would let the arrow overlap the text, so the inline-end padding is wider.
71 select:not([class*='components-']) {
72 min-block-size: var(--cs-control-height);
73 padding-block: 0;
74 padding-inline: 8px 24px;
75 border: 1px solid var(--cs-color-border);
76 border-radius: var(--cs-control-radius);
77
78 // WP 7.0 leaves a tall (≈38px) line-height on selects, pushing the value off-centre.
79 // Pin it so the text stays vertically centred within the token height.
80 line-height: 2;
81 color: var(--cs-color-text);
82 font-size: 14px;
83
84 &:focus {
85 border-color: var(--cs-color-accent);
86 box-shadow: 0 0 0 1px var(--cs-color-accent);
87 outline: 2px solid transparent;
88 }
89 }
90
91 // Secondary buttons: token geometry, the grey fill and the brand accent border/text in
92 // place of WP 7.0's transparent + modern-blue treatment. `.button-primary` is excluded
93 // so its solid fill below is not overwritten. The line-height centres text vertically
94 // in anchor-based buttons, which lack a button element's automatic centring.
95 .button:not(.button-primary, .button-link),
96 .button-secondary,
97 .page-title-action {
98 min-block-size: var(--cs-control-height);
99 padding-block: 0;
100 padding-inline: 12px;
101 border-radius: var(--cs-control-radius);
102 line-height: 2.5715;
103 font-size: 14px;
104 font-weight: 400;
105 background: #f6f7f7;
106 border-color: var(--cs-color-accent);
107 color: var(--cs-color-accent);
108
109 &:hover:not(:disabled) {
110 background: #f0f0f1;
111 border-color: var(--cs-color-accent-hover);
112 color: var(--cs-color-accent-hover);
113 }
114
115 &:focus:not(:disabled) {
116 border-color: #3582c4;
117 box-shadow: 0 0 0 1px #3582c4;
118 outline: 2px solid transparent;
119 }
120 }
121
122 // Primary buttons: WP 7.0 recolours these with the modern accent and drops the solid
123 // fill. Restore the classic solid brand-accent fill with white text. The `:not`
124 // matches the secondary rule's specificity so a `.button-small.button-primary`
125 // keeps the token height instead of collapsing to the 26px small size.
126 .button-primary:not(.button-link) {
127 min-block-size: var(--cs-control-height);
128 padding-block: 0;
129 padding-inline: 12px;
130 border-radius: var(--cs-control-radius);
131 line-height: 2.5715;
132 font-size: 14px;
133 font-weight: 700;
134 background: var(--cs-color-accent);
135 border-color: var(--cs-color-accent);
136 color: #fff;
137
138 &:hover:not(:disabled) {
139 background: var(--cs-color-accent-hover);
140 border-color: var(--cs-color-accent-hover);
141 color: #fff;
142 }
143
144 &:focus:not(:disabled) {
145 background: var(--cs-color-accent-hover);
146 border-color: var(--cs-color-accent-hover);
147 box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--cs-color-accent);
148 outline: 2px solid transparent;
149 }
150 }
151
152 // Small buttons stay compact rather than inheriting the 40px control height.
153 .button-small {
154 min-block-size: 26px;
155 line-height: 2.1818;
156 font-size: 11px;
157 }
158 }
159
160 .wp-core-ui .wrap .button .dashicons {
161 color: inherit;
162
163 // WP 7.0's taller button line-height leaks onto dashicon glyphs inside buttons (e.g. the
164 // conditions badge icon), pushing them out of vertical alignment. Reset it so icons stay
165 // centred — mirrors the existing `.button svg` rule for SVG icons.
166 line-height: 1;
167 }
168
169 // The Screen Options panel sits outside the page wrapper, in WordPress' own
170 // screen meta region. These stylesheets are only loaded on the plugin's screens,
171 // so its checkboxes are styled to match the ones in the page below it.
172 #adv-settings {
173 input[type='checkbox']='checkbox'] {
174 @include checkbox.canonical;
175 }
176
177 // The canonical checkbox drops the margin WordPress relies on here, and the
178 // gap otherwise comes from whitespace in the markup, which differs between
179 // the fieldsets this plugin prints and the ones WordPress prints.
180 label {
181 display: inline-flex;
182 align-items: center;
183 gap: 6px;
184 }
185 }
186