{
  "name": "settings-layout",
  "type": "registry:block",
  "framework": "react",
  "title": "Settings layout",
  "description": "A settings screen: grouped sections down the side and the chosen section's breadcrumb, heading and content beside them.",
  "registryDependencies": [
    "@newtui/side-nav",
    "@newtui/breadcrumb"
  ],
  "files": [
    {
      "path": "blocks/settings-layout/settings-layout.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Breadcrumb, BreadcrumbItem } from \"@/registry/bases/newt/ui/breadcrumb\"\nimport {\n  SideNav,\n  SideNavGroup,\n  SideNavItem,\n} from \"@/registry/bases/newt/ui/side-nav\"\n\n/*\n * The shape the layout reads. A block does not know your router; map your\n * sections onto this at the edge of it.\n */\nexport interface SettingsSection {\n  id: string\n  label: string\n  /** A count shown beside the entry. */\n  badge?: number\n  /** For an entry that destroys something. It is never the current section. */\n  danger?: boolean\n}\n\nexport interface SettingsGroup {\n  /** The small heading over the group. */\n  label?: string\n  sections: readonly SettingsSection[]\n}\n\nexport interface SettingsLayoutProps extends Omit<\n  React.ComponentProps<\"div\">,\n  \"title\"\n> {\n  /** What is being configured; the first crumb and the nav's name. */\n  title: string\n  groups: readonly SettingsGroup[]\n  /** The id of the section being shown. */\n  section: string\n  onSectionChange?: (section: string) => void\n}\n\n/*\n * A settings screen: the list of sections down the side, and the chosen\n * section's heading, breadcrumb and content beside it. The content is the\n * children, so each section stays an ordinary component of yours. The\n * content column is a plain box and not a `<main>`, because the page the\n * block is dropped into has one already. Below 40rem the navigation moves\n * above the content.\n */\nexport function SettingsLayout({\n  title,\n  groups,\n  section,\n  onSectionChange,\n  className,\n  children,\n  ...props\n}: SettingsLayoutProps) {\n  const current = groups\n    .flatMap((group) => group.sections)\n    .find((each) => each.id === section)\n\n  return (\n    <div\n      className={cn(\n        \"flex w-full flex-col bg-newt-bg-elevated sm:flex-row\",\n        className\n      )}\n      {...props}\n    >\n      <SideNav\n        aria-label={title}\n        className=\"shrink-0 bg-newt-bg-surface px-2 sm:w-56\"\n      >\n        {groups.map((group, index) => (\n          <SideNavGroup key={group.label ?? index} label={group.label}>\n            {group.sections.map((each) => (\n              <SideNavItem\n                key={each.id}\n                badge={each.badge}\n                variant={each.danger ? \"danger\" : \"default\"}\n                current={!each.danger && each.id === section}\n                onClick={() => onSectionChange?.(each.id)}\n              >\n                {each.label}\n              </SideNavItem>\n            ))}\n          </SideNavGroup>\n        ))}\n      </SideNav>\n      <div className=\"flex min-w-0 flex-1 flex-col gap-4 p-6\">\n        <Breadcrumb>\n          <BreadcrumbItem>{title}</BreadcrumbItem>\n          <BreadcrumbItem current>{current?.label ?? section}</BreadcrumbItem>\n        </Breadcrumb>\n        <h2 className=\"m-0 text-xl font-semibold leading-6 text-newt-text-primary\">\n          {current?.label ?? section}\n        </h2>\n        {children}\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ]
}