Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/SparkTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import {
SortableContext,
arrayMove,
horizontalListSortingStrategy,
rectSortingStrategy,
sortableKeyboardCoordinates,
useSortable,
} from "@dnd-kit/sortable";
Expand Down Expand Up @@ -351,7 +351,10 @@ export function SparkTabs({
>
<nav className="pill-nav" aria-label="Sparks">
<OverviewTab isActive={activeId === OVERVIEW_ID} onSelect={onSelect} />
<SortableContext items={items} strategy={horizontalListSortingStrategy}>
{/* rect (not horizontal-list) strategy: .pill-nav wraps onto several
rows once there are more Sparks than fit one line, and the
horizontal strategy only ever shifts items along X. */}
<SortableContext items={items} strategy={rectSortingStrategy}>
{ordered.map((spark) => (
<SortableTab
key={spark.id}
Expand Down
13 changes: 11 additions & 2 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,21 @@ input:disabled {
.pill-nav {
display: flex;
align-items: center;
/* Wrap onto further rows once the tabs no longer fit: the pills are
`shrink-0`/nowrap, so without this they spill past the nav (and the
viewport) as soon as there are more Sparks than fit on one line. */
flex-wrap: wrap;
gap: 4px;
background: var(--color-surface-elevated);
padding: 5px 6px;
border-radius: 50px;
/* 23px == fully rounded at the 45.5px single-row height (the browser clamps
it to half the height), and keeps sane corners once the nav is 2+ rows. */
border-radius: 23px;
box-shadow: var(--shadow-card);
flex: 1 1 auto;
/* Zero basis so the header's own flex-wrap never breaks the nav (and the
right-hand controls) onto extra header lines — the nav takes the space
that is left and wraps its tabs internally instead. */
flex: 1 1 0;
min-width: 0;
}

Expand Down