Skip to documentation

Design system / Sources & standards

Current repository source

link-directory.tsx

src/components/editorial/link-directory.tsx

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

import Link from "next/link";
import type { ComponentProps } from "react";
import { Text } from "@/components/ui/text";
import { cn } from "@/lib/utils";

export type DirectoryItem = {
  id: string;
  title: string;
  href: string;
  description?: string;
  index?: string;
};
/** Molecule: ruled directory links; callers own destinations and indexing. */
export function LinkDirectory({
  items,
  className,
  ...props
}: Omit<ComponentProps<"ul">, "children"> & {
  items: readonly DirectoryItem[];
}) {
  return (
    <ul
      {...props}
      data-slot="link-directory"
      className={cn("divide-y border-y", className)}
    >
      {items.map((item) => (
        <li key={item.id}>
          <Link
            href={item.href}
            className="flex min-w-0 items-start gap-4 py-5 text-body hover:bg-navigation-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
          >
            {item.index != null && (
              <Text
                as="span"
                variant="eyebrow"
                accent="monospace"
                aria-hidden
                className="shrink-0 text-text-muted"
              >
                {item.index}
              </Text>
            )}
            <span className="min-w-0 space-y-2">
              <span className="block break-words font-semibold">
                {item.title}
              </span>{" "}
              {item.description != null && (
                <Text
                  as="span"
                  variant="supporting"
                  rhythm="loose"
                  className="block break-words text-text-muted"
                >
                  {item.description}
                </Text>
              )}
            </span>
          </Link>
        </li>
      ))}
    </ul>
  );
}
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.