Skip to content

Commit 3b014cb

Browse files
Copilothotlong
andcommitted
feat: ListView toolbar - inline search input, activated state for Filter/Sort/Group/Color buttons, responsive overflow
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 89455cf commit 3b014cb

1 file changed

Lines changed: 18 additions & 34 deletions

File tree

packages/plugin-list/src/ListView.tsx

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ export const ListView: React.FC<ListViewProps> = ({
10121012

10131013
{/* Airtable-style Toolbar — Row 2: Tool buttons */}
10141014
<div className="border-b px-2 sm:px-4 py-1 flex items-center justify-between gap-1 sm:gap-2 bg-background">
1015-
<div className="flex items-center gap-0.5 overflow-hidden flex-1 min-w-0">
1015+
<div className="flex items-center gap-0.5 overflow-x-auto flex-1 min-w-0">
10161016
{/* Hide Fields */}
10171017
{toolbarFlags.showHideFields && (
10181018
<Popover open={showHideFields} onOpenChange={setShowHideFields}>
@@ -1081,7 +1081,7 @@ export const ListView: React.FC<ListViewProps> = ({
10811081
size="sm"
10821082
className={cn(
10831083
"h-7 px-2 text-muted-foreground hover:text-primary text-xs",
1084-
hasFilters && "text-primary"
1084+
hasFilters && "bg-primary/10 border border-primary/20 text-primary"
10851085
)}
10861086
>
10871087
<SlidersHorizontal className="h-3.5 w-3.5 mr-1.5" />
@@ -1120,7 +1120,7 @@ export const ListView: React.FC<ListViewProps> = ({
11201120
size="sm"
11211121
className={cn(
11221122
"h-7 px-2 text-muted-foreground hover:text-primary text-xs",
1123-
groupingConfig && "text-primary"
1123+
groupingConfig && "bg-primary/10 border border-primary/20 text-primary"
11241124
)}
11251125
>
11261126
<Group className="h-3.5 w-3.5 mr-1.5" />
@@ -1180,7 +1180,7 @@ export const ListView: React.FC<ListViewProps> = ({
11801180
size="sm"
11811181
className={cn(
11821182
"h-7 px-2 text-muted-foreground hover:text-primary text-xs",
1183-
currentSort.length > 0 && "text-primary"
1183+
currentSort.length > 0 && "bg-primary/10 border border-primary/20 text-primary"
11841184
)}
11851185
>
11861186
<ArrowUpDown className="h-3.5 w-3.5 mr-1.5" />
@@ -1219,7 +1219,7 @@ export const ListView: React.FC<ListViewProps> = ({
12191219
size="sm"
12201220
className={cn(
12211221
"h-7 px-2 text-muted-foreground hover:text-primary text-xs",
1222-
rowColorConfig && "text-primary"
1222+
rowColorConfig && "bg-primary/10 border border-primary/20 text-primary"
12231223
)}
12241224
>
12251225
<Paintbrush className="h-3.5 w-3.5 mr-1.5" />
@@ -1355,42 +1355,26 @@ export const ListView: React.FC<ListViewProps> = ({
13551355

13561356
{/* Search */}
13571357
{toolbarFlags.showSearch && (
1358-
searchExpanded ? (
1359-
<div className="relative w-36 sm:w-48 lg:w-64">
1358+
<div className="relative w-48">
13601359
<Search className="absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" />
13611360
<Input
1362-
placeholder="Find..."
1361+
placeholder="Search..."
13631362
value={searchTerm}
13641363
onChange={(e) => handleSearchChange(e.target.value)}
13651364
className="pl-7 h-7 text-xs bg-muted/50 border-transparent hover:bg-muted focus:bg-background focus:border-input transition-colors"
1366-
autoFocus
1367-
onBlur={() => {
1368-
if (!searchTerm) setSearchExpanded(false);
1369-
}}
13701365
/>
1371-
<Button
1372-
variant="ghost"
1373-
size="sm"
1374-
className="absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20"
1375-
onClick={() => {
1376-
handleSearchChange('');
1377-
setSearchExpanded(false);
1378-
}}
1379-
>
1380-
<X className="h-3 w-3" />
1381-
</Button>
1366+
{searchTerm && (
1367+
<Button
1368+
variant="ghost"
1369+
size="sm"
1370+
className="absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20"
1371+
onClick={() => handleSearchChange('')}
1372+
>
1373+
<X className="h-3 w-3" />
1374+
</Button>
1375+
)}
13821376
</div>
1383-
) : (
1384-
<Button
1385-
variant="ghost"
1386-
size="sm"
1387-
className="h-7 px-2 text-muted-foreground hover:text-primary text-xs"
1388-
onClick={() => setSearchExpanded(true)}
1389-
>
1390-
<Search className="h-3.5 w-3.5 mr-1.5" />
1391-
<span className="hidden sm:inline">Search</span>
1392-
</Button>
1393-
))}
1377+
)}
13941378
</div>
13951379
</div>
13961380

0 commit comments

Comments
 (0)