PluginProbe
Code Snippets / 3.10.0-beta.1
Code Snippets v3.10.0-beta.1
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.1, at css/common/_subnav.scss

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