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.

feat: add skills-lock.json and update documentation components

Aniket-508111f9d71fc11
diff --git a/apps/web/components/docs-base-switcher.tsx b/apps/web/components/docs-base-switcher.tsx
index d758b1b..ce305e3 100644
--- a/apps/web/components/docs-base-switcher.tsx
+++ b/apps/web/components/docs-base-switcher.tsx
@@ -5,40 +5,27 @@ import { cn } from "@/lib/utils";
import { BASE_NAMES, BASES, getBase } from "@/registry/bases";
import type { BaseName } from "@/registry/bases";
-type DocsBaseSwitcherSection = "components" | "blocks" | "theming";
-
-const DOCS_BASE_SWITCHER_SECTIONS = new Set<DocsBaseSwitcherSection>([
- "components",
- "blocks",
- "theming",
-]);
-
-const isDocsBaseSwitcherSection = (
- section: string
-): section is DocsBaseSwitcherSection =>
- DOCS_BASE_SWITCHER_SECTIONS.has(section as DocsBaseSwitcherSection);
-
-export const getDocsBaseSwitcherProps = (
- slug?: string[]
-): {
- section: DocsBaseSwitcherSection;
- base: string;
- slug?: string;
-} | null => {
- if (!slug || slug.length < 2) {
- return null;
- }
+// Slug depth at which a page carries the switcher: `theming/<base>` is itself a
+// doc, while `components/<base>` and `blocks/<base>` only list that base's items.
+const SWITCHER_SLUG_DEPTH: Record<string, number | undefined> = {
+ blocks: 3,
+ components: 3,
+ theming: 2,
+};
- const [section, base, ...rest] = slug;
+export const getDocsBaseSwitcherProps = (slug?: string[]) => {
+ const [section = "", base = "", ...rest] = slug ?? [];
+ const depth = SWITCHER_SLUG_DEPTH[section];
if (
- !BASE_NAMES.includes(base as BaseName) ||
- !isDocsBaseSwitcherSection(section)
+ !depth ||
+ rest.length + 2 < depth ||
+ !BASE_NAMES.includes(base as BaseName)
) {
return null;
}
- return { base, section, slug: rest.length > 0 ? rest.join("/") : undefined };
+ return { base, section, slug: rest.join("/") || undefined };
};
export const DocsBaseSwitcher = ({
@@ -49,7 +36,7 @@ export const DocsBaseSwitcher = ({
}: {
base: string;
slug?: string;
- section: DocsBaseSwitcherSection;
+ section: string;
className?: string;
}) => {
const activeBase = getBase(base as (typeof BASES)[number]["name"]);
diff --git a/apps/web/content/docs/blocks/forme/meta.json b/apps/web/content/docs/blocks/forme/meta.json
index 72742da..c18ec16 100644
--- a/apps/web/content/docs/blocks/forme/meta.json
+++ b/apps/web/content/docs/blocks/forme/meta.json
@@ -1,6 +1,6 @@
{
"pages": [
- "!index",
+ "index",
"invoice-classic",
"invoice-consultant",
"invoice-corporate",
diff --git a/apps/web/content/docs/blocks/index.mdx b/apps/web/content/docs/blocks/index.mdx
index 95472aa..f413c62 100644
--- a/apps/web/content/docs/blocks/index.mdx
+++ b/apps/web/content/docs/blocks/index.mdx
@@ -3,4 +3,4 @@ title: Blocks
description: Pre-built invoices and reports composed from pdfcn components.
---
-<ComponentsList className="mt-4" folderName="Blocks" base="takumi" />
+<ComponentsList folderName="Blocks" />
diff --git a/apps/web/content/docs/blocks/takumi/meta.json b/apps/web/content/docs/blocks/takumi/meta.json
index ed12e4d..18b8d23 100644
--- a/apps/web/content/docs/blocks/takumi/meta.json
+++ b/apps/web/content/docs/blocks/takumi/meta.json
@@ -1,6 +1,6 @@
{
"pages": [
- "!index",
+ "index",
"invoice-classic",
"invoice-consultant",
"invoice-corporate",
diff --git a/apps/web/content/docs/components/forme/meta.json b/apps/web/content/docs/components/forme/meta.json
index 7b6999d..2c049fa 100644
--- a/apps/web/content/docs/components/forme/meta.json
+++ b/apps/web/content/docs/components/forme/meta.json
@@ -1,6 +1,6 @@
{
"pages": [
- "!index",
+ "index",
"alert",
"badge",
"card",
diff --git a/apps/web/content/docs/components/index.mdx b/apps/web/content/docs/components/index.mdx
index 77bd97d..51e3da5 100644
--- a/apps/web/content/docs/components/index.mdx
+++ b/apps/web/content/docs/components/index.mdx
@@ -3,4 +3,4 @@ title: Components
description: Here you can find all the PDF components available in the library.
---
-<ComponentsList className="mt-4" base="takumi" />
+<ComponentsList />
diff --git a/apps/web/content/docs/components/takumi/meta.json b/apps/web/content/docs/components/takumi/meta.json
index ba1f7d4..6bb138f 100644
--- a/apps/web/content/docs/components/takumi/meta.json
+++ b/apps/web/content/docs/components/takumi/meta.json
@@ -1,6 +1,6 @@
{
"pages": [
- "!index",
+ "index",
"alert",
"badge",
"card",
diff --git a/apps/web/content/docs/themes/index.mdx b/apps/web/content/docs/themes/index.mdx
index 2ea892d..2ba2a3c 100644
--- a/apps/web/content/docs/themes/index.mdx
+++ b/apps/web/content/docs/themes/index.mdx
@@ -3,4 +3,4 @@ title: Themes
description: Pre-built theme presets for styling your PDF components.
---
-<ComponentsList className="mt-4" folderName="Themes" />
+<ComponentsList folderName="Themes" />
diff --git a/apps/web/skills-lock.json b/skills-lock.json
similarity index 100%
rename from apps/web/skills-lock.json
rename to skills-lock.json