PluginProbe
Code Snippets / 3.10.0
Code Snippets v3.10.0
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 3.0.1 All 64 releases
code-snippets / css / common / _subnav.scss

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

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