Skip to content

Commit e8f024e

Browse files
committed
Refactor documentation components and update deployment configuration: modified component pages to streamline code formatting, adjusted deployment script for Cloudflare, and updated ignored files in biome.json to include new directories.
1 parent 0c34f9f commit e8f024e

27 files changed

Lines changed: 833 additions & 818 deletions

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
VITE_STORYBOOK_URL: ${{ vars.STORYBOOK_URL || 'https://storybook.solidcn.nizarfadlan.dev' }}
4747

4848
- name: Deploy to Cloudflare Pages
49-
run: pnpm exec wrangler pages deploy apps/docs/.output/public --project-name=solidcn-docs
49+
run: pnpm exec wrangler pages deploy apps/docs/.output/public --project-name=solidcn
5050
env:
5151
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
5252
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

apps/docs/src/components/ui/CodeBlock.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,7 @@ export const CodeBlock: Component<CodeBlockProps> = (props) => {
154154
</pre>
155155
}
156156
>
157-
<div
158-
class={variant() === "figure" ? shikiPreFigure : shikiPreCard}
159-
innerHTML={html()}
160-
/>
157+
<div class={variant() === "figure" ? shikiPreFigure : shikiPreCard} innerHTML={html()} />
161158
</Show>
162159

163160
<Show when={!props.filename}>
@@ -175,7 +172,11 @@ export const CodeBlock: Component<CodeBlockProps> = (props) => {
175172
when={copied()}
176173
fallback={<Copy class="size-3.5 shrink-0" stroke-width={2} aria-hidden="true" />}
177174
>
178-
<Check class="size-3.5 shrink-0 text-green-600 dark:text-green-400" stroke-width={2} aria-hidden="true" />
175+
<Check
176+
class="size-3.5 shrink-0 text-green-600 dark:text-green-400"
177+
stroke-width={2}
178+
aria-hidden="true"
179+
/>
179180
</Show>
180181
</Show>
181182
<Show when={variant() !== "figure"}>{copied() ? "Copied!" : "Copy"}</Show>

apps/docs/src/components/ui/ComponentDemo.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ export const ComponentDemo: Component<ComponentDemoProps> = (props) => {
1717
const [codeOpen, setCodeOpen] = createSignal(false);
1818

1919
return (
20-
<div
21-
class={`rounded-lg border border-border bg-card shadow-sm ${props.class ?? ""}`}
22-
>
20+
<div class={`rounded-lg border border-border bg-card shadow-sm ${props.class ?? ""}`}>
2321
{/* Preview — bottom border is the seam the pill straddles */}
2422
<div class="flex min-h-[200px] items-center justify-center rounded-t-lg border-b border-border bg-background/80 p-8">
2523
{props.preview}

apps/docs/src/components/ui/DocPage.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,7 @@ export const DocPage: Component<DocPageProps> = (props) => {
149149
<DocLayout toc={toc}>
150150
<Show when={props.docPath} keyed>
151151
{(path) => (
152-
<DocsSeo
153-
title={`${props.title} — solidcn`}
154-
description={props.description}
155-
path={path}
156-
/>
152+
<DocsSeo title={`${props.title} — solidcn`} description={props.description} path={path} />
157153
)}
158154
</Show>
159155
<div class="space-y-10 pb-16">
@@ -171,7 +167,10 @@ export const DocPage: Component<DocPageProps> = (props) => {
171167
onClick={() => void copyPageMarkdown()}
172168
class="inline-flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-xs font-medium text-muted-foreground transition-colors hover:border-foreground/30 hover:text-foreground"
173169
>
174-
<Show when={pageCopied()} fallback={<Clipboard class="h-3.5 w-3.5" stroke-width={2} />}>
170+
<Show
171+
when={pageCopied()}
172+
fallback={<Clipboard class="h-3.5 w-3.5" stroke-width={2} />}
173+
>
175174
<Check class="h-3.5 w-3.5 text-green-600 dark:text-green-400" stroke-width={2} />
176175
</Show>
177176
{pageCopied() ? "Copied" : "Copy page"}

apps/docs/src/components/ui/DocPager.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { A } from "@solidjs/router";
2-
import { Show, type Component } from "solid-js";
2+
import { type Component, Show } from "solid-js";
33
import type { NavItem } from "../../lib/nav.js";
44

55
export interface DocPagerProps {
@@ -21,7 +21,9 @@ export const DocPager: Component<DocPagerProps> = (props) => {
2121
class="group flex w-full max-w-md flex-col justify-center rounded-lg border border-border bg-card px-4 py-3 text-left transition-colors hover:bg-muted/50"
2222
>
2323
<span class="text-xs font-medium text-muted-foreground">Previous</span>
24-
<span class="mt-0.5 font-medium text-foreground group-hover:underline">{p().title}</span>
24+
<span class="mt-0.5 font-medium text-foreground group-hover:underline">
25+
{p().title}
26+
</span>
2527
</A>
2628
)}
2729
</Show>
@@ -34,7 +36,9 @@ export const DocPager: Component<DocPagerProps> = (props) => {
3436
class="group flex w-full max-w-md flex-col items-end justify-center rounded-lg border border-border bg-card px-4 py-3 text-right transition-colors hover:bg-muted/50"
3537
>
3638
<span class="text-xs font-medium text-muted-foreground">Next</span>
37-
<span class="mt-0.5 font-medium text-foreground group-hover:underline">{n().title}</span>
39+
<span class="mt-0.5 font-medium text-foreground group-hover:underline">
40+
{n().title}
41+
</span>
3842
</A>
3943
)}
4044
</Show>

apps/docs/src/lib/build-doc-markdown.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ export function buildDocPageMarkdown(input: BuildDocMarkdownInput): string {
3232
if (input.componentName ?? input.manualInstall) {
3333
lines.push("## Installation", "");
3434
if (input.componentName) {
35-
lines.push("### CLI", "", "```bash", `npx solidcn@latest add ${input.componentName}`, "```", "");
35+
lines.push(
36+
"### CLI",
37+
"",
38+
"```bash",
39+
`npx solidcn@latest add ${input.componentName}`,
40+
"```",
41+
"",
42+
);
3643
}
3744
if (input.manualInstall) {
3845
lines.push("### Manual", "", "```bash", input.manualInstall, "```", "");
@@ -67,6 +74,6 @@ export function buildDocPageMarkdown(input: BuildDocMarkdownInput): string {
6774
lines.push("");
6875
}
6976

70-
lines.push("---", "", `_Exported from solidcn docs._`, "");
77+
lines.push("---", "", "_Exported from solidcn docs._", "");
7178
return lines.join("\n");
7279
}

apps/docs/src/lib/nav.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ export function getFlatNavItems(): NavItem[] {
1414
return navigation.flatMap((g) => g.items);
1515
}
1616

17-
export function getDocNeighbors(
18-
href: string,
19-
): { prev: NavItem | undefined; next: NavItem | undefined } {
17+
export function getDocNeighbors(href: string): {
18+
prev: NavItem | undefined;
19+
next: NavItem | undefined;
20+
} {
2021
const items = getFlatNavItems();
2122
const i = items.findIndex((item) => item.href === href);
2223
if (i < 0) {

apps/docs/src/routes/docs/components/accordion.tsx

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ function AccordionDemo() {
2929
export default function AccordionPage() {
3030
return (
3131
<DocPage
32-
docPath="/docs/components/accordion"
33-
title="Accordion"
34-
description="A vertically stacked set of interactive headings that reveal/hide associated content. Built on Kobalte Accordion."
35-
phase="Core Primitives"
36-
componentName="accordion"
37-
manualInstall="npm install @solidcn/core"
38-
examples={[
39-
{
40-
title: "Single (collapsible)",
41-
preview: <AccordionDemo />,
42-
code: `import {
32+
docPath="/docs/components/accordion"
33+
title="Accordion"
34+
description="A vertically stacked set of interactive headings that reveal/hide associated content. Built on Kobalte Accordion."
35+
phase="Core Primitives"
36+
componentName="accordion"
37+
manualInstall="npm install @solidcn/core"
38+
examples={[
39+
{
40+
title: "Single (collapsible)",
41+
preview: <AccordionDemo />,
42+
code: `import {
4343
Accordion, AccordionContent,
4444
AccordionItem, AccordionTrigger,
4545
} from "~/components/ui/accordion";
@@ -58,22 +58,22 @@ export default function AccordionPage() {
5858
</AccordionContent>
5959
</AccordionItem>
6060
</Accordion>`,
61-
},
62-
{
63-
title: "Multiple open",
64-
preview: (
65-
<Accordion multiple class="w-full max-w-md">
66-
<AccordionItem value="a">
67-
<AccordionTrigger>Section A</AccordionTrigger>
68-
<AccordionContent>Content for section A.</AccordionContent>
69-
</AccordionItem>
70-
<AccordionItem value="b">
71-
<AccordionTrigger>Section B</AccordionTrigger>
72-
<AccordionContent>Content for section B.</AccordionContent>
73-
</AccordionItem>
74-
</Accordion>
75-
),
76-
code: `<Accordion multiple class="w-full">
61+
},
62+
{
63+
title: "Multiple open",
64+
preview: (
65+
<Accordion multiple class="w-full max-w-md">
66+
<AccordionItem value="a">
67+
<AccordionTrigger>Section A</AccordionTrigger>
68+
<AccordionContent>Content for section A.</AccordionContent>
69+
</AccordionItem>
70+
<AccordionItem value="b">
71+
<AccordionTrigger>Section B</AccordionTrigger>
72+
<AccordionContent>Content for section B.</AccordionContent>
73+
</AccordionItem>
74+
</Accordion>
75+
),
76+
code: `<Accordion multiple class="w-full">
7777
<AccordionItem value="a">
7878
<AccordionTrigger>Section A</AccordionTrigger>
7979
<AccordionContent>Content for section A.</AccordionContent>
@@ -83,33 +83,33 @@ export default function AccordionPage() {
8383
<AccordionContent>Content for section B.</AccordionContent>
8484
</AccordionItem>
8585
</Accordion>`,
86-
},
87-
]}
88-
props={[
89-
{
90-
name: "collapsible",
91-
type: "boolean",
92-
default: "false",
93-
description: "Allow closing the open item",
94-
},
95-
{
96-
name: "multiple",
97-
type: "boolean",
98-
default: "false",
99-
description: "Allow multiple items open simultaneously",
100-
},
101-
{ name: "value", type: "string | string[]", description: "Controlled open item(s)" },
102-
{
103-
name: "defaultValue",
104-
type: "string | string[]",
105-
description: "Default open item(s) (uncontrolled)",
106-
},
107-
{
108-
name: "onChange",
109-
type: "(value: string | string[]) => void",
110-
description: "Callback on value change",
111-
},
112-
]}
113-
/>
86+
},
87+
]}
88+
props={[
89+
{
90+
name: "collapsible",
91+
type: "boolean",
92+
default: "false",
93+
description: "Allow closing the open item",
94+
},
95+
{
96+
name: "multiple",
97+
type: "boolean",
98+
default: "false",
99+
description: "Allow multiple items open simultaneously",
100+
},
101+
{ name: "value", type: "string | string[]", description: "Controlled open item(s)" },
102+
{
103+
name: "defaultValue",
104+
type: "string | string[]",
105+
description: "Default open item(s) (uncontrolled)",
106+
},
107+
{
108+
name: "onChange",
109+
type: "(value: string | string[]) => void",
110+
description: "Callback on value change",
111+
},
112+
]}
113+
/>
114114
);
115115
}

apps/docs/src/routes/docs/components/badge.tsx

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,45 @@ import { DocPage } from "../../../components/ui/DocPage.js";
44
export default function BadgePage() {
55
return (
66
<DocPage
7-
docPath="/docs/components/badge"
8-
title="Badge"
9-
description="A small label used to highlight status, category, or count."
10-
phase="Core Primitives"
11-
componentName="badge"
12-
manualInstall="npm install @solidcn/core"
13-
examples={[
14-
{
15-
title: "Default",
16-
preview: <Badge>Badge</Badge>,
17-
code: `import { Badge } from "~/components/ui/badge";
7+
docPath="/docs/components/badge"
8+
title="Badge"
9+
description="A small label used to highlight status, category, or count."
10+
phase="Core Primitives"
11+
componentName="badge"
12+
manualInstall="npm install @solidcn/core"
13+
examples={[
14+
{
15+
title: "Default",
16+
preview: <Badge>Badge</Badge>,
17+
code: `import { Badge } from "~/components/ui/badge";
1818
1919
<Badge>Badge</Badge>`,
20-
},
21-
{
22-
title: "Variants",
23-
preview: (
24-
<div class="flex flex-wrap gap-2">
25-
<Badge variant="default">Default</Badge>
26-
<Badge variant="secondary">Secondary</Badge>
27-
<Badge variant="destructive">Destructive</Badge>
28-
<Badge variant="outline">Outline</Badge>
29-
</div>
30-
),
31-
code: `<Badge variant="default">Default</Badge>
20+
},
21+
{
22+
title: "Variants",
23+
preview: (
24+
<div class="flex flex-wrap gap-2">
25+
<Badge variant="default">Default</Badge>
26+
<Badge variant="secondary">Secondary</Badge>
27+
<Badge variant="destructive">Destructive</Badge>
28+
<Badge variant="outline">Outline</Badge>
29+
</div>
30+
),
31+
code: `<Badge variant="default">Default</Badge>
3232
<Badge variant="secondary">Secondary</Badge>
3333
<Badge variant="destructive">Destructive</Badge>
3434
<Badge variant="outline">Outline</Badge>`,
35-
},
36-
]}
37-
props={[
38-
{
39-
name: "variant",
40-
type: '"default" | "secondary" | "destructive" | "outline"',
41-
default: '"default"',
42-
description: "Visual style",
43-
},
44-
{ name: "class", type: "string", description: "Additional CSS classes" },
45-
]}
46-
/>
35+
},
36+
]}
37+
props={[
38+
{
39+
name: "variant",
40+
type: '"default" | "secondary" | "destructive" | "outline"',
41+
default: '"default"',
42+
description: "Visual style",
43+
},
44+
{ name: "class", type: "string", description: "Additional CSS classes" },
45+
]}
46+
/>
4747
);
4848
}

0 commit comments

Comments
 (0)