Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

3.5 KB
Raw Blame
import type { Meta, StoryObj } from "@storybook/react-vite";
import { VERTICALS, ALL_ENDPOINTS } from "@processor/data/endpoints";
import { MethodBadge } from "@editor/ui/MethodBadge";
import { StatusBadge } from "@editor/ui/StatusBadge";

const meta: Meta = {
  title: "Data/Endpoint catalogue",
  parameters: {
    layout: "padded",
    docs: {
      description: {
        component:
          "Live preview of the typed endpoint catalogue in src/data/endpoints.ts. Verticals come from VERTICALS, the flat list from ALL_ENDPOINTS.",
      },
    },
  },
};
export default meta;
type Story = StoryObj;

export const ByVertical: Story = {
  render: () => (
    <div style={{ display: "flex", flexDirection: "column", gap: 22 }}>
      <div style={{ fontSize: 12, color: "var(--c-text-subtle)" }}>
        {ALL_ENDPOINTS.length} endpoints across {VERTICALS.length} verticals
      </div>
      {VERTICALS.map((v) => (
        <div key={v.key}>
          <div
            style={{
              display: "flex",
              alignItems: "center",
              gap: 10,
              marginBottom: 8,
            }}
          >
            <span
              style={{
                width: 8,
                height: 8,
                borderRadius: 2,
                background: v.color,
              }}
            />
            <h3 style={{ margin: 0, fontSize: 14, color: "var(--c-text)" }}>
              {v.label}
            </h3>
            <span style={{ fontSize: 12, color: "var(--c-text-subtle)" }}>
              {v.endpoints.length} endpoints
            </span>
          </div>
          <div style={{ display: "grid", gap: 8 }}>
            {v.endpoints.map((e) => (
              <div
                key={e.endpoint}
                style={{
                  display: "grid",
                  gridTemplateColumns: "4.375rem 13.75rem 1fr auto",
                  gap: 12,
                  alignItems: "center",
                  padding: "0.625rem 0.875rem",
                  background: "var(--c-surface)",
                  border: "1px solid var(--c-border)",
                  borderRadius: "var(--radius-md)",
                }}
              >
                <MethodBadge method="POST" />
                <span
                  style={{
                    fontFamily: "var(--font-mono)",
                    fontSize: 12,
                    color: "var(--c-text-muted)",
                  }}
                >
                  {e.endpoint}
                </span>
                <div style={{ minWidth: 0 }}>
                  <div
                    style={{
                      fontSize: 13,
                      fontWeight: 500,
                      color: "var(--c-text)",
                    }}
                  >
                    {e.name}
                  </div>
                  <div
                    style={{
                      fontSize: 12,
                      color: "var(--c-text-subtle)",
                      overflow: "hidden",
                      textOverflow: "ellipsis",
                      whiteSpace: "nowrap",
                    }}
                  >
                    {e.desc}
                  </div>
                </div>
                <StatusBadge
                  tone={
                    e.tier === 0 ? "success" : e.tier === 1 ? "info" : "purple"
                  }
                  size="sm"
                >
                  {e.tier === 0 ? "free" : e.tier === 1 ? "paid" : "enterprise"}
                </StatusBadge>
              </div>
            ))}
          </div>
        </div>
      ))}
    </div>
  ),
};