Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit b08c824

Browse files
committed
refactor(admin): rebalance ContentListToolbar layout
Search now spans the available row width with no artificial cap; filter, sort, refresh, and selection collapse into a single right cluster. The selection control keeps a consistent visual register: a bare checkbox when empty, a neutral count chip + danger-tinted bulk-action chip when populated, replacing the previous inverted black pill.
1 parent f48262f commit b08c824

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

apps/admin/src/features/_shared/components/content-list-toolbar.tsx

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function ContentListToolbar(props: ContentListToolbarProps) {
9292
)}
9393
>
9494
<form
95-
className="relative flex h-full min-w-0 max-w-80 flex-1 items-center self-stretch border-r border-neutral-200 pr-3 dark:border-neutral-800"
95+
className="relative flex h-full min-w-0 flex-1 items-center self-stretch"
9696
onSubmit={props.onSearch}
9797
>
9898
<Search
@@ -130,13 +130,17 @@ export function ContentListToolbar(props: ContentListToolbarProps) {
130130
{props.sortMenu}
131131

132132
{props.extraActions ? (
133-
<div className="flex shrink-0 items-center gap-1.5">
134-
{props.extraActions}
135-
</div>
133+
<>
134+
<span
135+
aria-hidden="true"
136+
className="h-3.5 w-px shrink-0 bg-neutral-200 dark:bg-neutral-800"
137+
/>
138+
<div className="flex shrink-0 items-center gap-1.5">
139+
{props.extraActions}
140+
</div>
141+
</>
136142
) : null}
137143

138-
<div className="min-w-0 flex-1" />
139-
140144
{selection ? (
141145
<ContentListToolbarSelectionControls
142146
hasSelection={hasSelection}
@@ -154,48 +158,44 @@ function ContentListToolbarSelectionControls(props: {
154158
const { hasSelection, selection } = props
155159

156160
if (!hasSelection) {
161+
if (!selection.hasVisibleItems) return null
157162
return (
158-
<div className="inline-flex h-7 shrink-0 items-center gap-3 text-xs text-neutral-500 dark:text-neutral-400">
159-
{selection.hasVisibleItems ? (
160-
<label className="inline-flex cursor-pointer items-center gap-1.5 transition-colors hover:text-neutral-950 dark:hover:text-neutral-50">
161-
<Checkbox
162-
aria-label={selection.selectAllLabel}
163-
checked={selection.allVisibleSelected}
164-
indeterminate={selection.indeterminate}
165-
onCheckedChange={selection.onToggleAllVisible}
166-
/>
167-
<span className="hidden sm:inline">{selection.selectAllLabel}</span>
168-
</label>
169-
) : null}
170-
</div>
163+
<label
164+
aria-label={selection.selectAllLabel}
165+
className="inline-flex h-7 shrink-0 cursor-pointer items-center justify-center px-1 text-neutral-500 transition-colors hover:text-neutral-950 dark:text-neutral-400 dark:hover:text-neutral-50"
166+
title={selection.selectAllLabel}
167+
>
168+
<Checkbox
169+
aria-label={selection.selectAllLabel}
170+
checked={selection.allVisibleSelected}
171+
indeterminate={selection.indeterminate}
172+
onCheckedChange={selection.onToggleAllVisible}
173+
/>
174+
</label>
171175
)
172176
}
173177

174178
return (
175-
<div className="inline-flex h-7 shrink-0 items-center overflow-hidden rounded bg-neutral-950 text-xs text-white dark:bg-neutral-50 dark:text-neutral-950">
176-
{selection.hasVisibleItems ? (
177-
<div className="inline-flex h-full items-center gap-2 border-r border-white/15 px-2 dark:border-neutral-950/15">
178-
<Checkbox
179-
aria-label={selection.selectAllLabel}
180-
checked={selection.allVisibleSelected}
181-
indeterminate={selection.indeterminate}
182-
onCheckedChange={selection.onToggleAllVisible}
183-
/>
184-
</div>
185-
) : null}
186-
<span className="px-2 tabular-nums text-white/80 dark:text-neutral-950/80">
187-
{selection.selectedLabel}
188-
</span>
179+
<>
180+
<label className="inline-flex h-7 shrink-0 cursor-pointer items-center gap-1.5 rounded bg-neutral-100 px-2 text-xs tabular-nums text-neutral-700 dark:bg-neutral-900 dark:text-neutral-200">
181+
<Checkbox
182+
aria-label={selection.selectAllLabel}
183+
checked={selection.allVisibleSelected}
184+
indeterminate={selection.indeterminate}
185+
onCheckedChange={selection.onToggleAllVisible}
186+
/>
187+
<span>{selection.selectedLabel}</span>
188+
</label>
189189
<button
190-
className="outline-hidden inline-flex h-full shrink-0 items-center gap-1.5 border-l border-white/15 px-2.5 font-medium transition-colors hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-[var(--color-primary-shallow)] disabled:pointer-events-none disabled:opacity-50 dark:border-neutral-950/15 dark:hover:bg-neutral-950/10"
190+
className="outline-hidden inline-flex h-7 shrink-0 items-center gap-1.5 rounded border border-red-200 bg-red-50/60 px-2 text-xs text-red-700 transition-colors hover:bg-red-100 focus-visible:ring-2 focus-visible:ring-[var(--color-primary-shallow)] disabled:pointer-events-none disabled:opacity-50 dark:border-red-900 dark:bg-red-950/30 dark:text-red-300 dark:hover:bg-red-950/50"
191191
disabled={selection.bulkActionDisabled}
192192
onClick={selection.onBulkAction}
193193
type="button"
194194
>
195195
{selection.bulkActionIcon}
196196
<span>{selection.bulkActionLabel}</span>
197197
</button>
198-
</div>
198+
</>
199199
)
200200
}
201201

0 commit comments

Comments
 (0)