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 / _subnav.scss

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

276 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 @use 'theme';
2
3 // Snippet-type navigation: a boxed segmented control on a white band, with
4 // each tab separated by a vertical rule and the active tab shown as a
5 // filled tile.
6 .snippet-type-nav-wrapper {
7 position: relative;
8
9 // Bleed across the full admin content width, flush against the plugin toolbar.
10 box-sizing: border-box;
11 min-block-size: 53px;
12 margin-block-start: -1px;
13 margin-inline-start: -22px;
14 inline-size: calc(100% + 42px);
15 overflow: hidden;
16 background: #fff;
17
18 &::before,
19 &::after {
20 position: absolute;
21 inset-block: 0;
22 z-index: 1;
23 inline-size: 32px;
24 content: '';
25 opacity: 0;
26 pointer-events: none;
27 transition: opacity 150ms ease;
28 }
29
30 &::before {
31 inset-inline-start: 0;
32 background: linear-gradient(to right, #fff, transparent);
33 }
34
35 &::after {
36 inset-inline-end: 0;
37 background: linear-gradient(to left, #fff, transparent);
38 }
39
40 &.has-scroll-start::before,
41 &.has-scroll-end::after {
42 opacity: 1;
43 }
44
45 @media (width <= 782px) {
46 margin-inline-start: -10px;
47 inline-size: calc(100% + 22px);
48 }
49 }
50
51 .snippet-type-nav {
52 // The tab band scrolls sideways instead of wrapping at any width.
53 overflow-x: auto;
54 scrollbar-width: thin;
55
56 // The row line is painted on the scrollport so it remains fixed while tabs scroll.
57 background: linear-gradient(to top, #e2e2e4 1px, #fff 1px);
58
59 @media (width <= 960px) {
60 li {
61 flex: 1 1 0;
62 }
63
64 .snippet-type-link {
65 inline-size: 100%;
66 min-inline-size: 100px;
67 padding-inline: 4px;
68 }
69 }
70
71 @media (width <= 782px) {
72 scrollbar-width: none;
73
74 &::-webkit-scrollbar {
75 display: none;
76 }
77 }
78
79 ul {
80 display: flex;
81 align-items: stretch;
82 flex-wrap: nowrap;
83 min-block-size: 53px;
84 margin: 0;
85 padding: 0;
86 list-style: none;
87 }
88
89 li {
90 display: flex;
91 flex: 0 0 auto;
92 margin: 0;
93 }
94
95 button.snippet-type-link {
96 background: none;
97 border-block: none;
98 border-inline-start: none;
99 font-family: inherit;
100 }
101
102 .snippet-type-icon {
103 font-size: 22px;
104 inline-size: 24px;
105 block-size: 24px;
106 }
107
108 .snippet-type-link {
109 display: flex;
110 align-items: center;
111 justify-content: center;
112 gap: 8px;
113 min-inline-size: 100px;
114 padding-block: 0;
115 padding-inline: 24px;
116 cursor: pointer;
117 font-size: 14px;
118 font-weight: 600;
119 line-height: 1.5;
120 white-space: nowrap;
121 color: #646970;
122 text-decoration: none;
123 box-sizing: border-box;
124 border-inline-end: 1px solid #e2e2e4;
125
126 // The text-only "All Snippets" tab uses a slightly wider gap between
127 // its label and count than tabs that lead with a badge or icon.
128 &.all-type-link {
129 gap: 12px;
130 }
131
132 svg {
133 display: block;
134 inline-size: 24px;
135 block-size: 24px;
136 }
137
138 &:hover,
139 &:focus,
140 &:active {
141 color: #2c3337;
142 }
143
144 &.active-type {
145 background: #f0f0f1;
146 color: theme.$accent;
147 }
148
149 // Suppress the persistent focus ring left behind after a mouse click;
150 // keyboard navigation still gets a visible outline via :focus-visible.
151 &:focus-visible {
152 outline: 2px solid theme.$accent;
153 outline-offset: -2px;
154 box-shadow: none;
155 }
156
157 &:focus:not(:focus-visible) {
158 outline: none;
159 box-shadow: none;
160 }
161
162 &.pro-locked-type {
163 color: #646970;
164 }
165 }
166
167 }
168
169 // Card/table view toggle: a two-icon segmented pair of square tiles with
170 // the active view filled in the accent colour.
171 .snippet-view-toggle {
172 display: flex;
173 align-items: center;
174 gap: 4px;
175
176 .snippet-view-toggle-option {
177 display: flex;
178 align-items: center;
179 justify-content: center;
180 inline-size: 38px;
181 block-size: 38px;
182 box-sizing: border-box;
183 padding: 0;
184 margin: 0;
185 background: #f0f0f1;
186 color: #646970;
187 border: none;
188 border-radius: 4.5px;
189 cursor: pointer;
190
191 svg {
192 display: block;
193 }
194
195 &:hover,
196 &:focus {
197 color: #2c3337;
198 }
199
200 &.active-view {
201 background: theme.$accent;
202 color: #fff;
203
204 &:hover,
205 &:focus {
206 color: #fff;
207 }
208 }
209 }
210 }
211
212 // Slot that adopts the WordPress Screen Options / Help tabs so they appear
213 // directly below the snippet-type nav instead of above the page content.
214 .snippets-screen-meta-slot {
215 #screen-meta-links {
216 float: none;
217 display: flex;
218 justify-content: flex-end;
219 margin: 0;
220 border-color: #e2e2e4;
221
222 .show-settings {
223 border-color: #e2e2e4;
224 }
225 }
226
227 #screen-meta {
228 margin: 0;
229 }
230 }
231
232 // Item count shown after a subnav tab's label, using the label colour at reduced opacity.
233 .snippet-type-nav .subnav-count {
234 font-size: 14px;
235 font-weight: 600;
236 line-height: 1.5;
237 color: currentcolor;
238 opacity: 0.65;
239 }
240
241 // Keep the active count tied to its active label rather than assigning a separate colour.
242 .snippet-type-nav .snippet-type-link.active-type .subnav-count {
243 color: currentcolor;
244 }
245
246 // The short "All" form of the all-snippets label only replaces "All Snippets"
247 // once the bar collapses; the full form is shown at every wider width.
248 .snippet-type-name-short {
249 display: none;
250 }
251
252 // Collapse at mid-width and below (through mobile): drop the type names so each
253 // tab shows just its badge and count, and shorten "All Snippets" to "All". Only
254 // the badged manage nav owns a .snippet-type-name; the text-only import/settings
255 // subnav tabs are untouched. Below 782px the bar still scrolls sideways (above),
256 // now with the compact collapsed tabs.
257 @media (width <= 1210px) {
258 .snippet-type-nav .snippet-type-link:not(.all-type-link) .snippet-type-name {
259 display: none;
260 }
261
262 .snippet-type-nav .all-type-link .snippet-type-name-full {
263 display: none;
264 }
265
266 .snippet-type-nav .all-type-link .snippet-type-name-short {
267 display: inline;
268 }
269 }
270
271 // When an admin notice pushes the page content down, restore the top border
272 // above the subnav bar (no extra margin — the wrapper sits flush).
273 .notice + .wrap .snippet-type-nav-wrapper {
274 border-block-start: 1px solid #e2e2e4;
275 }
276