Skip to content

Commit 82e3b82

Browse files
committed
nest styles
1 parent e7bc3cb commit 82e3b82

File tree

2 files changed

+87
-89
lines changed

2 files changed

+87
-89
lines changed

packages/site-kit/src/lib/search/SearchBox.svelte

Lines changed: 83 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -265,36 +265,34 @@ It appears when the user clicks on the `Search` component or presses the corresp
265265
}
266266
267267
input {
268-
font-family: inherit;
269268
font-size: 1.6rem;
270269
width: 100%;
271270
padding: 1rem 6rem 0.5rem 1rem;
272271
height: 5rem;
273272
border: none;
274273
border-bottom: 1px solid var(--sk-back-3);
275-
font-weight: 600;
276274
flex-shrink: 0;
277275
background: var(--sk-back-2);
278276
color: var(--sk-text-1);
279-
}
280277
281-
input::selection {
282-
background-color: var(--sk-back-translucent);
283-
}
278+
&::selection {
279+
background-color: var(--sk-back-translucent);
280+
}
284281
285-
input::placeholder {
286-
color: var(--sk-text-3);
287-
opacity: 0.3;
288-
}
282+
&::placeholder {
283+
color: var(--sk-text-3);
284+
opacity: 0.3;
285+
}
289286
290-
input:focus-visible {
291-
background: var(--sk-theme-2);
292-
color: white;
293-
outline: none;
294-
}
287+
&:focus-visible {
288+
background: var(--sk-theme-2);
289+
color: white;
290+
outline: none;
291+
}
295292
296-
input:focus-visible::placeholder {
297-
color: rgba(255, 255, 255, 0.5);
293+
&:focus-visible::placeholder {
294+
color: rgba(255, 255, 255, 0.5);
295+
}
298296
}
299297
300298
button[aria-label='Close'] {
@@ -306,16 +304,16 @@ It appears when the user clicks on the `Search` component or presses the corresp
306304
height: 5rem;
307305
background: none;
308306
color: var(--sk-text-2);
309-
}
310307
311-
button[aria-label='Close']:focus-visible {
312-
background: var(--sk-theme-2);
313-
color: var(--sk-back-1);
314-
outline: none;
315-
}
308+
&:focus-visible {
309+
background: var(--sk-theme-2);
310+
color: var(--sk-back-1);
311+
outline: none;
312+
}
316313
317-
input:focus-visible + button[aria-label='Close'] {
318-
color: var(--sk-back-1);
314+
input:focus-visible + & {
315+
color: var(--sk-back-1);
316+
}
319317
}
320318
321319
ul {
@@ -324,20 +322,17 @@ It appears when the user clicks on the `Search` component or presses the corresp
324322
325323
.modal {
326324
position: fixed;
325+
display: flex;
326+
justify-content: center;
327+
align-items: center;
328+
pointer-events: none;
327329
left: 0;
328330
top: 0;
329331
width: 100%;
330332
height: 100%;
331333
z-index: 9999;
332334
}
333335
334-
.modal {
335-
display: flex;
336-
justify-content: center;
337-
align-items: center;
338-
pointer-events: none;
339-
}
340-
341336
.search-box {
342337
position: relative;
343338
height: calc(100% - 2rem);
@@ -349,10 +344,10 @@ It appears when the user clicks on the `Search` component or presses the corresp
349344
display: flex;
350345
flex-direction: column;
351346
overflow: hidden;
352-
}
353347
354-
.search-box > * {
355-
pointer-events: all;
348+
& > * {
349+
pointer-events: all;
350+
}
356351
}
357352
358353
.results {
@@ -384,54 +379,54 @@ It appears when the user clicks on the `Search` component or presses the corresp
384379
text-decoration: none;
385380
line-height: 1;
386381
padding: 1rem;
387-
}
388382
389-
a:hover {
390-
background: rgba(0, 0, 0, 0.05);
391-
}
383+
&:hover {
384+
background: rgba(0, 0, 0, 0.05);
385+
}
392386
393-
a:focus {
394-
background: var(--sk-theme-2);
395-
color: var(--sk-back-1);
396-
outline: none;
397-
}
387+
&:focus {
388+
background: var(--sk-theme-2);
389+
color: var(--sk-back-1);
390+
outline: none;
391+
}
398392
399-
a small,
400-
a strong {
401-
display: block;
402-
white-space: nowrap;
403-
overflow: hidden;
404-
text-overflow: ellipsis;
405-
line-height: 1;
406-
}
393+
& small,
394+
& strong {
395+
display: block;
396+
white-space: nowrap;
397+
overflow: hidden;
398+
text-overflow: ellipsis;
399+
line-height: 1;
400+
}
407401
408-
a small {
409-
font-size: 1rem;
410-
text-transform: uppercase;
411-
font-weight: 600;
412-
color: var(--sk-text-3);
413-
}
402+
& small {
403+
font-size: 1rem;
404+
text-transform: uppercase;
405+
font-weight: 600;
406+
color: var(--sk-text-3);
407+
}
414408
415-
a strong {
416-
font-size: 1.6rem;
417-
color: var(--sk-text-2);
418-
margin: 0.4rem 0;
419-
}
409+
& strong {
410+
font-size: 1.6rem;
411+
color: var(--sk-text-2);
412+
margin: 0.4rem 0;
413+
}
420414
421-
a:focus small {
422-
color: white;
423-
opacity: 0.6;
424-
}
415+
&:focus small {
416+
color: white;
417+
opacity: 0.6;
418+
}
425419
426-
a:focus strong {
427-
color: white;
428-
}
420+
&:focus strong {
421+
color: white;
422+
}
429423
430-
a strong :global(mark) {
431-
background: var(--sk-theme-2);
432-
color: var(--sk-text-3);
433-
text-decoration: none;
434-
border-radius: 1px;
424+
& strong :global(mark) {
425+
background: var(--sk-theme-2);
426+
color: var(--sk-text-3);
427+
text-decoration: none;
428+
border-radius: 1px;
429+
}
435430
}
436431
437432
li {
@@ -446,21 +441,21 @@ It appears when the user clicks on the `Search` component or presses the corresp
446441
height: 100%;
447442
color: var(--sk-text-2);
448443
opacity: 0.1;
449-
}
450444
451-
a:focus + [aria-label='Delete'] {
452-
color: var(--sk-back-1);
453-
}
445+
&:hover {
446+
opacity: 1;
447+
outline: none;
448+
}
454449
455-
button[aria-label='Delete']:hover {
456-
opacity: 1;
457-
outline: none;
458-
}
450+
&:focus-visible {
451+
background: var(--sk-theme-2);
452+
color: var(--sk-text-1);
453+
opacity: 1;
454+
outline: none;
455+
}
459456
460-
button[aria-label='Delete']:focus-visible {
461-
background: var(--sk-theme-2);
462-
color: var(--sk-text-1);
463-
opacity: 1;
464-
outline: none;
457+
a:focus + & {
458+
color: var(--sk-back-1);
459+
}
465460
}
466461
</style>

packages/site-kit/src/lib/styles/base.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,12 @@ blockquote :last-child {
146146
}
147147

148148
/* buttons -------------------------------- */
149-
button {
149+
input, button {
150150
font-family: var(--sk-font-ui);
151151
font-size: inherit;
152+
}
153+
154+
button {
152155
background-color: transparent;
153156
border: none;
154157
color: currentColor;

0 commit comments

Comments
 (0)