Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

refactor: update routing constants and component documentation paths for consistency

Aniket-5082afbefb40aab
diff --git a/app/(app)/docs/[[...slug]]/page.tsx b/app/(app)/docs/[[...slug]]/page.tsx
index 9fe0fe1..1e4cd78 100644
--- a/app/(app)/docs/[[...slug]]/page.tsx
+++ b/app/(app)/docs/[[...slug]]/page.tsx
@@ -57,7 +57,7 @@ const buildBreadcrumbs = (
pageTitle: string,
pageUrl: string
) => {
- const items: { name: string; path: string }[] = [{ name: "Home", path: "/" }];
+ const items: { name: string; path: string }[] = [{ name: "Home", path: ROUTES.HOME }];
if (slugs.length === 0) {
items.push({ name: pageTitle, path: pageUrl });
diff --git a/app/sitemap.ts b/app/sitemap.ts
index f5c3d94..e518419 100644
--- a/app/sitemap.ts
+++ b/app/sitemap.ts
@@ -23,7 +23,7 @@ const sitemap = (): MetadataRoute.Sitemap => {
const docPages: MetadataRoute.Sitemap = source.getPages().map((page) => ({
changeFrequency: "weekly" as const,
lastModified: new Date(),
- priority: page.url === "/docs" ? 0.9 : 0.8,
+ priority: page.url === ROUTES.DOCS ? 0.9 : 0.8,
url: `${SITE.URL}${page.url}`,
}));
diff --git a/components/docs-base-switcher.tsx b/components/docs-base-switcher.tsx
index c0d4557..950175b 100644
--- a/components/docs-base-switcher.tsx
+++ b/components/docs-base-switcher.tsx
@@ -1,5 +1,6 @@
import Link from "next/link";
+import { ROUTES } from "@/constants/routes";
import { cn } from "@/lib/utils";
import { BASE_NAMES, BASES, getBase } from "@/registry/bases";
import type { BaseName } from "@/registry/bases";
@@ -61,7 +62,7 @@ export const DocsBaseSwitcher = ({
{BASES.map((baseItem) => (
<Link
key={baseItem.name}
- href={`/docs/${section}/${baseItem.name}${slug ? `/${slug}` : ""}`}
+ href={`${ROUTES.DOCS}/${section}/${baseItem.name}${slug ? `/${slug}` : ""}`}
data-active={base === baseItem.name}
className="relative inline-flex items-center justify-center gap-1 pt-1 pb-0.5 text-base font-medium text-muted-foreground transition-colors after:absolute after:inset-x-0 after:bottom-[-4px] after:h-0.5 after:bg-foreground after:opacity-0 after:transition-opacity hover:text-foreground data-[active=true]:text-foreground data-[active=true]:after:opacity-100"
>
diff --git a/components/home-pdf-preview.tsx b/components/home-pdf-preview.tsx
index edbd4c6..6d59044 100644
--- a/components/home-pdf-preview.tsx
+++ b/components/home-pdf-preview.tsx
@@ -5,105 +5,105 @@ export const homePdfComponentCatalog = {
codeName: "Alert",
description:
"A callout block for warnings, notes, and important information.",
- docsPath: "components/alert",
+ docsPath: "/alert",
label: "Alert",
},
badge: {
codeName: "Badge",
description:
"A styled label for status indicators, tags, and inline annotations.",
- docsPath: "components/badge",
+ docsPath: "/badge",
label: "Badge",
},
card: {
codeName: "Card",
description:
"A contained layout for grouping related content with border and padding.",
- docsPath: "components/card",
+ docsPath: "/card",
label: "Card",
},
"data-table": {
codeName: "DataTable",
description:
"A full-featured data table with sorting, pagination, and cell formatting.",
- docsPath: "components/data-table",
+ docsPath: "/data-table",
label: "Data table",
},
divider: {
codeName: "Divider",
description:
"A visual separator with configurable color, thickness, and margin.",
- docsPath: "components/divider",
+ docsPath: "/divider",
label: "Divider",
},
graph: {
codeName: "Graph",
description:
"A data visualization component for charts and statistical graphics.",
- docsPath: "components/graph",
+ docsPath: "/graph",
label: "Graph",
},
"key-value": {
codeName: "KeyValue",
description:
"A flexible key-value layout for metadata, summaries, and label pairs.",
- docsPath: "components/key-value",
+ docsPath: "/key-value",
label: "Key-value",
},
list: {
codeName: "List",
description:
"An ordered or unordered list with custom markers and nested items.",
- docsPath: "components/list",
+ docsPath: "/list",
label: "List",
},
"page-footer": {
codeName: "PageFooter",
description:
"A compact document footer with page numbers, legal text, and brand marks.",
- docsPath: "components/page-footer",
+ docsPath: "/page-footer",
label: "Page footer",
},
"page-header": {
codeName: "PageHeader",
description:
"A branded document header with logo, company details, and document title.",
- docsPath: "components/page-header",
+ docsPath: "/page-header",
label: "Page header",
},
"pdf-image": {
codeName: "PdfImage",
description:
"An image component optimized for PDF rendering with aspect ratio and sizing.",
- docsPath: "components/pdf-image",
+ docsPath: "/pdf-image",
label: "Image",
},
section: {
codeName: "Section",
description:
"A grouped content section with optional title, padding, and background.",
- docsPath: "components/section",
+ docsPath: "/section",
label: "Section",
},
signature: {
codeName: "Signature",
description:
"A signature block for authorized signatories and approval lines.",
- docsPath: "components/signature",
+ docsPath: "/signature",
label: "Signature",
},
table: {
codeName: "Table",
description:
"A structured data table with headers, rows, and responsive column widths.",
- docsPath: "components/table",
+ docsPath: "/table",
label: "Table",
},
text: {
codeName: "Text",
description:
"A versatile text component for headings, paragraphs, and inline content.",
- docsPath: "components/text",
+ docsPath: "/text",
label: "Text",
},
} as const;
@@ -140,7 +140,7 @@ export type PdfRecipeId =
export const homePdfPreviews = [
{
- actionHref: "https://pdfcn.run/docs/components",
+ actionHref: "https://pdfcn.dev/docs/components",
actionLabel: "Explore the collection",
componentIds: [
"page-header",
@@ -161,7 +161,7 @@ export const homePdfPreviews = [
previewText: "A new component collection from pdfcn",
},
{
- actionHref: "https://pdfcn.run/docs/installation",
+ actionHref: "https://pdfcn.dev/docs/installation",
actionLabel: "Build your first PDF",
componentIds: ["page-header", "text", "graph", "data-table", "page-footer"],
defaultComponentId: "graph",
@@ -175,7 +175,7 @@ export const homePdfPreviews = [
previewText: "Start building your first PDF",
},
{
- actionHref: "https://pdfcn.run/docs/components",
+ actionHref: "https://pdfcn.dev/docs/components",
actionLabel: "Browse components",
componentIds: [
"page-header",
diff --git a/components/home-pdf-showcase.tsx b/components/home-pdf-showcase.tsx
index 28b80b8..c5939b0 100644
--- a/components/home-pdf-showcase.tsx
+++ b/components/home-pdf-showcase.tsx
@@ -30,6 +30,7 @@ import {
import { Separator } from "@/components/ui/separator";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Toggle } from "@/components/ui/toggle";
+import { ROUTES } from "@/constants/routes";
import { cn } from "@/lib/utils";
const PdfPreview = dynamic(
@@ -473,7 +474,7 @@ export const HomePdfShowcase = () => {
<CardContent className="p-4" aria-live="polite">
<h3 className="text-lg font-semibold tracking-tight">
<Link
- href={`/docs/components/${selectedComponent.docsPath}`}
+ href={`${ROUTES.DOCS_COMPONENTS}/${pdfBase}/${selectedComponent.docsPath}`}
className="group inline-flex items-center gap-1.5 rounded-sm underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
transitionTypes={["nav-forward"]}
>
diff --git a/constants/site.ts b/constants/site.ts
index 717efc8..dfbd86e 100644
--- a/constants/site.ts
+++ b/constants/site.ts
@@ -1,3 +1,5 @@
+import { ROUTES } from "@/constants/routes";
+
export const FALLBACK_SITE_ORIGIN = "https://pdfcn.dev" as const;
const getBaseUrl = () => {
@@ -33,7 +35,7 @@ export const SITE = {
"npx shadcn add",
] as const,
NAME: "pdfcn",
- OG_IMAGE: `${baseUrl}/og`,
+ OG_IMAGE: `${baseUrl}${ROUTES.OG}`,
REGISTRY: "@pdfcn",
URL: baseUrl,
};