ui improvement
This commit is contained in:
82
src/components/searchInput.css
Normal file
82
src/components/searchInput.css
Normal file
@@ -0,0 +1,82 @@
|
||||
/* ══ Search box ════════════════════════════════════════════════════════════
|
||||
Shaped to match the view-tab track it sits opposite — see the note in
|
||||
`SearchInput.tsx`. Every number here is the same number `tabBar.css` uses. */
|
||||
|
||||
.searchbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
/* The track's height and the track's corner. This is the whole point of the
|
||||
component: a search that is visibly the same object as the buttons at the
|
||||
other end of the row. */
|
||||
height: 38px;
|
||||
padding: 0 10px;
|
||||
border-radius: var(--card-radius-sm);
|
||||
border: var(--card-border);
|
||||
background: var(--card-bg);
|
||||
box-shadow: var(--card-shadow);
|
||||
max-width: 100%;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease;
|
||||
}
|
||||
|
||||
/* Fills its container, for a box sitting directly above the list it filters. */
|
||||
.searchbox[data-full='true'] { display: flex; width: 100%; }
|
||||
|
||||
.searchbox:hover { border-color: var(--color-ink-4); }
|
||||
|
||||
/* Focus lands on the BOX, not on the bare input inside it — the input has no
|
||||
border of its own, so the default ring would draw inside the box and read as
|
||||
a second, smaller field. */
|
||||
.searchbox:focus-within {
|
||||
border-color: var(--color-brand);
|
||||
box-shadow: 0 0 0 3px var(--color-brand-tint);
|
||||
}
|
||||
|
||||
.searchbox-icon { flex: none; color: var(--color-ink-4); }
|
||||
.searchbox:focus-within .searchbox-icon { color: var(--color-brand); }
|
||||
|
||||
.searchbox-input {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
color: var(--color-ink-1);
|
||||
font: 400 13px/1 var(--font-sans);
|
||||
outline: none;
|
||||
/* Safari draws its own rounded field and inner shadow on a text input, and
|
||||
`type="search"` adds a magnifier and a cancel button on top of ours. */
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
.searchbox-input::placeholder { color: var(--color-ink-4); }
|
||||
.searchbox-input::-webkit-search-decoration,
|
||||
.searchbox-input::-webkit-search-cancel-button,
|
||||
.searchbox-input::-webkit-search-results-button {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.searchbox-clear {
|
||||
flex: none;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: var(--color-surface-sunken);
|
||||
color: var(--color-ink-3);
|
||||
cursor: pointer;
|
||||
transition: background 140ms ease, color 140ms ease;
|
||||
}
|
||||
.searchbox-clear:hover { background: var(--color-line); color: var(--color-ink-1); }
|
||||
.searchbox-clear:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 1px; }
|
||||
|
||||
/* On a phone the header row wraps, and a 260px box beside a scrolling tab
|
||||
track leaves neither enough room. It takes the full line instead. */
|
||||
@media (max-width: 600px) {
|
||||
.searchbox { width: 100% !important; }
|
||||
}
|
||||
Reference in New Issue
Block a user