Files
homarr/packages/ui/src/select-grid-layout.tsx
T
Thomas Camlong 3ff3d41d7c fix(init): improve integrations step UX
- Replace plain Base URL input with a prominent Alert callout so users
  don't overlook it
- Add disableScroll prop to SelectGridLayout and use it in onboarding
  so integrations expand the page instead of scrolling
- Fix Collapse `in` → `expanded` prop for Mantine v9 migration in both
  the URL helpers panel and the Docker discovery panel
2026-05-28 12:15:56 +02:00

49 lines
1.2 KiB
TypeScript

"use client";
import type { KeyboardEvent, ReactNode } from "react";
import { Input, ScrollArea, SimpleGrid, Stack } from "@mantine/core";
import { IconSearch } from "@tabler/icons-react";
export const selectGridCols = { base: 2, xs: 3, sm: 4, md: 5 };
export const selectGridCardHeight = 180;
export const selectGridScrollMaxHeight = "70vh";
interface SelectGridLayoutProps {
search: string;
onSearchChange: (value: string) => void;
placeholder: string;
onSearchKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
disableScroll?: boolean;
children: ReactNode;
}
export const SelectGridLayout = ({
search,
onSearchChange,
placeholder,
onSearchKeyDown,
disableScroll = false,
children,
}: SelectGridLayoutProps) => {
const grid = (
<SimpleGrid cols={selectGridCols} spacing="sm">
{children}
</SimpleGrid>
);
return (
<Stack>
<Input
value={search}
onChange={(event) => onSearchChange(event.currentTarget.value)}
leftSection={<IconSearch />}
placeholder={placeholder}
data-autofocus
onKeyDown={onSearchKeyDown}
/>
{disableScroll ? grid : <ScrollArea.Autosize mah={selectGridScrollMaxHeight}>{grid}</ScrollArea.Autosize>}
</Stack>
);
};