{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "projects",
  "type": "registry:block",
  "title": "Projects block",
  "description": "A studio's projects as one screen: a title with the count, a toolbar with the status filters, a search, a list or grid switch and New project, then the rows or the cards. Every empty case says why and offers the way back.",
  "registryDependencies": [
    "https://littmd.vercel.app/r/litt.json",
    "https://littmd.vercel.app/r/action-bar.json",
    "https://littmd.vercel.app/r/button.json",
    "https://littmd.vercel.app/r/framed.json",
    "https://littmd.vercel.app/r/icons.json",
    "https://littmd.vercel.app/r/input.json",
    "https://littmd.vercel.app/r/list.json",
    "https://littmd.vercel.app/r/segmented.json",
    "https://littmd.vercel.app/r/states.json"
  ],
  "files": [
    {
      "path": "registry/litt/components/litt-blocks/projects.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n// @litt/projects 2026.11.03. What changed: https://littmd.vercel.app/changelog.md\n\n/**\n * Projects: a studio's projects, as rows or cards, filtered by status. A block: a whole screen built from the litt\n * parts, to copy and make your own. Swap the sample projects at the top for yours (the Project shape is the list's);\n * the toolbar, the views and the empty states stay.\n *\n * A title with the count, then one toolbar: the status filters, a search field, a list or grid switch and New project,\n * the one accent fill. The rows arrive in one staggered cascade, the view's expressive moment. Every empty case says\n * why and offers the way back: a search with no match clears the search, and an empty status shows everything.\n * Cards ticked in the grid bring up the action bar at the bottom of the view, with Archive for all of them at once.\n * Render it inside your app's shell (the dashboard block's AppShell, for one).\n */\nimport { useState } from \"react\";\nimport { ActionBar } from \"../litt/action-bar\";\nimport { Button } from \"../litt/button\";\nimport { ArchiveIcon, PlusIcon } from \"../litt/icons\";\nimport { Input } from \"../litt/input\";\nimport { ProjectFilters, ProjectGrid, ProjectList, ProjectsEmpty, matchesFilter, type Project, type ProjectFilter } from \"../litt/list\";\nimport { Segmented } from \"../litt/segmented\";\nimport { Empty } from \"../litt/states\";\nimport { Heading } from \"../litt/framed\";\n\n/* ----------------------------------------------------------------- data */\n\n/** The studio's projects. Load yours; `href` makes each row a link to the project. */\nconst PROJECTS: Project[] = [\n  { id: \"halo\", name: \"Halo site\", client: \"Halo Studio\", deploy: \"Deployed 2 hours ago\", status: \"live\", updated: \"2026-10-20\", description: \"The studio site, on Framer with a custom CMS.\", tags: [\"Site\", \"CMS\"], cover: \"landing\" },\n  { id: \"northwind\", name: \"Northwind rebrand\", client: \"Northwind\", deploy: \"Deployed 3 days ago\", status: \"live\", updated: \"2025-11-04\", description: \"A new identity and the site that carries it.\", tags: [\"Identity\"], cover: \"identity\" },\n  { id: \"atlas\", name: \"Atlas portfolio\", client: \"Ines Ortega\", deploy: \"Preview ready\", status: \"review\", updated: \"2026-10-18\", description: \"A photographer's portfolio on a tight grid.\", tags: [\"Site\"], cover: \"type\" },\n  { id: \"lumen\", name: \"Lumen docs\", client: \"Marlow Labs\", deploy: \"Preview ready\", status: \"review\", updated: \"2026-10-15\", description: \"Docs with search and versioned pages.\", tags: [\"Docs\"], cover: \"system\" },\n  { id: \"kassa\", name: \"Kassa pitch deck\", client: \"Kassa\", deploy: \"No deploy yet\", status: \"draft\", updated: \"2025-09-12\", description: \"A seed deck, and the motion for its demo.\", tags: [\"Deck\", \"Motion\"], cover: \"motion\" },\n  { id: \"template\", name: \"Case study template\", client: \"Litt Templates\", deploy: \"No deploy yet\", status: \"draft\", updated: \"2026-10-02\", description: \"A template for long case studies.\", tags: [\"Template\"], cover: \"template\" },\n];\n\nconst WORDS = [\"No\", \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\", \"Ten\", \"Eleven\", \"Twelve\"];\n/** \"One project\", \"Six projects\": the number in words, and the noun that goes with it. */\nconst count = (n: number, one: string, many = `${one}s`) => `${WORDS[n] ?? n} ${n === 1 ? one : many}`;\n\n/** Does a project match what was typed? Its name, its client or a tag. */\nconst matchesQuery = (p: Project, query: string) => {\n  const q = query.trim().toLowerCase();\n  return !q || [p.name, p.client, ...(p.tags ?? [])].some((s) => s.toLowerCase().includes(q));\n};\n\n/* ----------------------------------------------------------------- the screen */\n\nexport function Projects() {\n  const [projects, setProjects] = useState(PROJECTS);\n  const [filter, setFilter] = useState<ProjectFilter>(\"all\");\n  const [query, setQuery] = useState(\"\");\n  const [view, setView] = useState(\"list\");\n  const [selected, setSelected] = useState<string[]>([]);\n\n  const found = projects.filter((p) => matchesQuery(p, query));\n  const shown = found.filter((p) => matchesFilter(p, filter));\n  const live = projects.filter((p) => p.status === \"live\").length;\n\n  /* Archiving takes the selected projects off the screen and ends the selection. */\n  const archive = () => {\n    setProjects((all) => all.filter((p) => !selected.includes(p.id)));\n    setSelected([]);\n  };\n\n  /* A new project is a draft at the top. Live and Review would hide it, so the filter goes back to All. */\n  const create = () => {\n    const n = projects.length - PROJECTS.length + 1;\n    setProjects([{ id: `new-${n}`, name: n === 1 ? \"Untitled project\" : `Untitled project ${n}`, client: \"Halo Studio\", deploy: \"No deploy yet\", status: \"draft\", updated: \"2026-10-21\", cover: \"blank\" }, ...projects]);\n    if (filter === \"live\" || filter === \"review\") setFilter(\"all\");\n    setQuery(\"\");\n  };\n\n  return (\n    <div className=\"@container grid w-full grid-cols-1 gap-8\">\n      <header className=\"flex flex-wrap items-end justify-between gap-4\">\n        <div className=\"grid gap-1\">\n          <Heading level={1} className=\"text-litt-h1 text-litt-fg\">Projects</Heading>\n          <p className=\"text-litt-body text-litt-fg-muted\">\n            {count(projects.length, \"project\")}, {count(live, \"live\", \"live\").toLowerCase()}.\n          </p>\n        </div>\n        <Button variant=\"primary\" size=\"sm\" icon={<PlusIcon />} onClick={create}>\n          New project\n        </Button>\n      </header>\n\n      <div className=\"flex flex-wrap items-center gap-4\">\n        <ProjectFilters value={filter} onChange={setFilter} />\n        <div className=\"flex flex-1 flex-wrap items-center justify-end gap-3\">\n          <Input\n            size=\"sm\"\n            type=\"search\"\n            aria-label=\"Search projects\"\n            placeholder=\"Search projects\"\n            value={query}\n            onChange={(e) => setQuery(e.target.value)}\n            className=\"w-full @min-[40rem]:w-56\"\n          />\n          <Segmented\n            legend=\"View\"\n            size=\"sm\"\n            value={view}\n            onValueChange={setView}\n            options={[\n              { value: \"list\", label: \"List\" },\n              { value: \"grid\", label: \"Grid\" },\n            ]}\n          />\n        </div>\n      </div>\n\n      {query.trim() && !found.length ? (\n        <Empty title={`No project matches “${query.trim()}”.`} action={<Button size=\"sm\" onClick={() => setQuery(\"\")}>Clear search</Button>}>\n          Search looks at names, clients and tags.\n        </Empty>\n      ) : view === \"grid\" ? (\n        <ProjectGrid\n          projects={found}\n          filter={filter}\n          selectedIds={selected}\n          onSelectedChange={(id, on) => setSelected((s) => (on ? [...s, id] : s.filter((x) => x !== id)))}\n          onClearFilter={() => setFilter(\"all\")}\n        />\n      ) : shown.length ? (\n        <ProjectList projects={shown} label=\"Projects\" />\n      ) : (\n        <ProjectsEmpty filter={filter} onClearFilter={() => setFilter(\"all\")} />\n      )}\n\n      {/* The grid's selection: what to do with the cards ticked. The list has no boxes, so the bar waits for the grid. */}\n      <ActionBar count={view === \"grid\" ? selected.length : 0} noun=\"projects\" onClear={() => setSelected([])}>\n        <Button size=\"sm\" icon={<ArchiveIcon />} onClick={archive}>\n          Archive\n        </Button>\n      </ActionBar>\n    </div>\n  );\n}\n",
      "target": "components/litt-blocks/projects.tsx"
    }
  ],
  "docs": "Import Projects from components/litt-blocks/projects and render it inside your app's shell. The sample projects sit at the top of the file in the list's Project shape; give each one an href to make its row a link. See it live at https://littmd.vercel.app/#projects.",
  "meta": {
    "version": "2026.11.03",
    "released": "2026-11-03",
    "changelog": "https://littmd.vercel.app/changelog.md"
  }
}
