From cdc1978f4ddc8d26f8f0ce85bf1b780ac9aeb3b5 Mon Sep 17 00:00:00 2001 From: Jaayden Halko Date: Wed, 18 Dec 2024 22:35:31 +0000 Subject: [PATCH] feat: add breadcrumbs to admin settings pages (#15865) resolves coder/internal#174 Uses shadcn/ui for admin settings breadcrumbs Figma: https://www.figma.com/design/OR75XeUI0Z3ksqt1mHsNQw/Dashboard-v1?node-id=139-1380&m=dev Screenshot 2024-12-13 at 21 37 18 Screenshot 2024-12-13 at 21 37 27 --- .../Breadcrumb/Breadcrumb.stories.tsx | 47 +++++++ site/src/components/Breadcrumb/Breadcrumb.tsx | 115 ++++++++++++++++++ .../management/DeploymentSettingsLayout.tsx | 39 ++++-- .../management/OrganizationSettingsLayout.tsx | 57 +++++++-- 4 files changed, 242 insertions(+), 16 deletions(-) create mode 100644 site/src/components/Breadcrumb/Breadcrumb.stories.tsx create mode 100644 site/src/components/Breadcrumb/Breadcrumb.tsx diff --git a/site/src/components/Breadcrumb/Breadcrumb.stories.tsx b/site/src/components/Breadcrumb/Breadcrumb.stories.tsx new file mode 100644 index 0000000000..0b02b2ebb9 --- /dev/null +++ b/site/src/components/Breadcrumb/Breadcrumb.stories.tsx @@ -0,0 +1,47 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { + Breadcrumb, + BreadcrumbEllipsis, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "components/Breadcrumb/Breadcrumb"; +import { MockOrganization } from "testHelpers/entities"; + +const meta: Meta = { + title: "components/Breadcrumb", + component: Breadcrumb, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + children: ( + + + + Admin Settings + + + + + + + + Organizations + + + + + {MockOrganization.name} + + + + + ), + }, +}; diff --git a/site/src/components/Breadcrumb/Breadcrumb.tsx b/site/src/components/Breadcrumb/Breadcrumb.tsx new file mode 100644 index 0000000000..cd6625a42c --- /dev/null +++ b/site/src/components/Breadcrumb/Breadcrumb.tsx @@ -0,0 +1,115 @@ +/** + * Copied from shadc/ui on 12/13/2024 + * @see {@link https://ui.shadcn.com/docs/components/breadcrumb} + */ +import { Slot } from "@radix-ui/react-slot"; +import { MoreHorizontal } from "lucide-react"; +import { + type ComponentProps, + type ComponentPropsWithoutRef, + type FC, + type ReactNode, + forwardRef, +} from "react"; +import { cn } from "utils/cn"; + +export const Breadcrumb = forwardRef< + HTMLElement, + ComponentPropsWithoutRef<"nav"> & { + separator?: ReactNode; + } +>(({ ...props }, ref) =>