Skip to content

Commit b0cb387

Browse files
Copilothotlong
andcommitted
fix: make row height toggle conditional on schema.rowHeight config
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 9eb2160 commit b0cb387

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

packages/plugin-grid/src/ObjectGrid.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -771,20 +771,23 @@ export const ObjectGrid: React.FC<ObjectGridProps> = ({
771771
const RowHeightIcon = rowHeightMode === 'compact' ? Rows4 : rowHeightMode === 'tall' ? AlignJustify : Rows3;
772772

773773
// Grid toolbar (row height toggle + export)
774-
const hasToolbar = schema.exportOptions || schema.rowHeight !== undefined;
774+
const showRowHeightToggle = schema.rowHeight !== undefined;
775+
const hasToolbar = schema.exportOptions || showRowHeightToggle;
775776
const gridToolbar = hasToolbar ? (
776777
<div className="flex items-center justify-end gap-1 px-2 py-1">
777778
{/* Row height toggle */}
778-
<Button
779-
variant="ghost"
780-
size="sm"
781-
className="h-7 px-2 text-muted-foreground hover:text-primary text-xs"
782-
onClick={cycleRowHeight}
783-
title={`Row height: ${rowHeightMode}`}
784-
>
785-
<RowHeightIcon className="h-3.5 w-3.5 mr-1.5" />
786-
<span className="hidden sm:inline capitalize">{rowHeightMode}</span>
787-
</Button>
779+
{showRowHeightToggle && (
780+
<Button
781+
variant="ghost"
782+
size="sm"
783+
className="h-7 px-2 text-muted-foreground hover:text-primary text-xs"
784+
onClick={cycleRowHeight}
785+
title={`Row height: ${rowHeightMode}`}
786+
>
787+
<RowHeightIcon className="h-3.5 w-3.5 mr-1.5" />
788+
<span className="hidden sm:inline capitalize">{rowHeightMode}</span>
789+
</Button>
790+
)}
788791

789792
{/* Export */}
790793
{schema.exportOptions && (

0 commit comments

Comments
 (0)