From b913fe329968bf51260636dbb13965d1729a62be Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Mon, 19 Oct 2026 18:57:47 -0300 Subject: [PATCH] Add sticky header --- .../src/components/items/list-composer.tsx | 21 +++++++++++++++++++ apps/web/src/routes/_authenticated/index.tsx | 7 ++----- .../_authenticated/lists/$listId/index.tsx | 7 ++----- 3 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 apps/web/src/components/items/list-composer.tsx diff --git a/apps/web/src/components/items/list-composer.tsx b/apps/web/src/components/items/list-composer.tsx new file mode 100644 index 0000000..7473ad2 --- /dev/null +++ b/apps/web/src/components/items/list-composer.tsx @@ -0,0 +1,21 @@ +import { CreateItemForm } from '@/components/items/create-item-form' +import { ListProgress } from '@/components/items/list-progress' + +type ListComposerProps = { + listId: string +} + +/** + * Progress plus the "add an item" input, pinned right below the app header while + * the items scroll. `top-16` matches the header's `h-16`, and the negative margins + * undo the layout's padding so the solid background also covers the gap above. + */ +export function ListComposer({ listId }: ListComposerProps) { + return ( +
+ + + +
+ ) +} diff --git a/apps/web/src/routes/_authenticated/index.tsx b/apps/web/src/routes/_authenticated/index.tsx index bf309ae..9621ef8 100644 --- a/apps/web/src/routes/_authenticated/index.tsx +++ b/apps/web/src/routes/_authenticated/index.tsx @@ -1,9 +1,8 @@ import { createFileRoute, Link } from '@tanstack/react-router' import { PlusIcon, ShoppingCartIcon } from 'lucide-react' -import { CreateItemForm } from '@/components/items/create-item-form' import { ItemList } from '@/components/items/item-list' -import { ListProgress } from '@/components/items/list-progress' +import { ListComposer } from '@/components/items/list-composer' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' @@ -52,9 +51,7 @@ function HomePage() { return (
- - - +
diff --git a/apps/web/src/routes/_authenticated/lists/$listId/index.tsx b/apps/web/src/routes/_authenticated/lists/$listId/index.tsx index 610eb11..bb1a4f9 100644 --- a/apps/web/src/routes/_authenticated/lists/$listId/index.tsx +++ b/apps/web/src/routes/_authenticated/lists/$listId/index.tsx @@ -1,8 +1,7 @@ import { createFileRoute } from '@tanstack/react-router' -import { CreateItemForm } from '@/components/items/create-item-form' import { ItemList } from '@/components/items/item-list' -import { ListProgress } from '@/components/items/list-progress' +import { ListComposer } from '@/components/items/list-composer' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Skeleton } from '@/components/ui/skeleton' import { itemsQueryOptions } from '@/hooks/use-items' @@ -50,9 +49,7 @@ function ListItemsPage() { return (
- - - +