Skip to content

Commit dcf6f69

Browse files
committed
add missing page header styling
1 parent d9a425a commit dcf6f69

File tree

7 files changed

+51
-24
lines changed

7 files changed

+51
-24
lines changed

content/docs/test-collection/components/stepper.mdx

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Stepper
33
---
44

55
import { Preview } from "@/components/preview"
6+
import { APIReference } from "renoun/components"
67

78
## Source
89

@@ -37,3 +38,7 @@ The component uses
3738

3839
</Stepper>
3940
</Preview>
41+
42+
## API Reference
43+
44+
<APIReference source="./src/components/ui/stepper.tsx" />

content/docs/test-collection/components/table.mdx

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Table
33
---
44

55
import { Preview } from "@/components/preview"
6+
import { APIReference } from "renoun/components"
67

78
## Source
89

@@ -172,3 +173,9 @@ The component uses
172173
]}
173174
/>
174175
</Preview>
176+
177+
## API Reference
178+
179+
<APIReference source="./src/components/table-builder.tsx" />
180+
181+
<APIReference source="./src/components/data-table-builder.tsx" />

src/app/docs/[...slug]/page.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ async function DirectoryContent({ source }: { source: EntryType }) {
158158
"w-full max-w-full",
159159
)}
160160
>
161-
<h1>{source.getTitle()}</h1>
161+
<h1
162+
className="no-prose mb-2 scroll-m-20 text-4xl font-light tracking-tight lg:text-5xl"
163+
data-pagefind-meta="title"
164+
>
165+
{source.getTitle()}
166+
</h1>
162167
</div>
163168

164169
<SectionGrid sections={sections} />

src/collections.ts

+22-17
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export const docSchema = {
2929
headings: headingSchema,
3030
}
3131

32+
export const allowedExtensions = ["mdx", "tsx", "ts"]
33+
3234
export const AriaDocsCollection = new Directory({
3335
path: "content/docs/aria-docs",
3436
// base path is required, otherwise we can't build the correct slugs in the `generateStaticParams`
@@ -38,6 +40,8 @@ export const AriaDocsCollection = new Directory({
3840
docSchema,
3941
(path) => import(`@content/docs/aria-docs/${path}.mdx`),
4042
),
43+
tsx: withSchema((path) => import(`@content/docs/aria-docs/${path}.tsx`)),
44+
ts: withSchema((path) => import(`@content/docs/aria-docs/${path}.ts`)),
4145
},
4246
})
4347

@@ -50,6 +54,8 @@ export const RenounDocsCollection = new Directory({
5054
docSchema,
5155
(path) => import(`@content/docs/renoun-docs/${path}.mdx`),
5256
),
57+
tsx: withSchema((path) => import(`@content/docs/renoun-docs/${path}.tsx`)),
58+
ts: withSchema((path) => import(`@content/docs/renoun-docs/${path}.ts`)),
5359
},
5460
})
5561

@@ -62,6 +68,12 @@ export const TestCollection = new Directory({
6268
docSchema,
6369
(path) => import(`@content/docs/test-collection/${path}.mdx`),
6470
),
71+
tsx: withSchema(
72+
(path) => import(`@content/docs/test-collection/${path}.tsx`),
73+
),
74+
ts: withSchema(
75+
(path) => import(`@content/docs/test-collection/${path}.ts`),
76+
),
6577
},
6678
})
6779

@@ -76,12 +88,10 @@ export type DirectoryType = Awaited<
7688

7789
export async function getDirectoryContent(source: EntryType) {
7890
// first, try to get the file based on the given path
79-
try {
80-
return await CollectionInfo.getDirectory(source.getPathSegments())
81-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
82-
} catch (e: unknown) {
83-
return null
84-
}
91+
92+
return await CollectionInfo.getDirectory(source.getPathSegments()).catch(
93+
() => null,
94+
)
8595
}
8696

8797
/**
@@ -94,20 +104,15 @@ export async function getDirectoryContent(source: EntryType) {
94104
*/
95105
export async function getFileContent(source: EntryType) {
96106
// first, try to get the file based on the given path
97-
try {
98-
return await CollectionInfo.getFile(source.getPathSegments(), "mdx")
99-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
100-
} catch (e: unknown) {
101-
try {
107+
108+
return await CollectionInfo.getFile(source.getPathSegments(), "mdx").catch(
109+
async () => {
102110
return await CollectionInfo.getFile(
103111
[...source.getPathSegments(), "index"],
104112
"mdx",
105-
)
106-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
107-
} catch (e: unknown) {
108-
return null
109-
}
110-
}
113+
).catch(() => null)
114+
},
115+
)
111116
}
112117

113118
/**

src/components/data-table-builder.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ import {
2222
import { DataTableColumnHeader } from "./data-table-column-header"
2323
import { DataTablePagination } from "./data-table-pagination"
2424

25-
interface DataTableProps<TData> {
25+
export interface DataTableProps<TData> {
2626
columns: { id: string; title: string }[]
2727
data: TData[]
2828
}
2929

30-
export default function DataTableBuilder<TData>({
30+
export function DataTableBuilder<TData>({
3131
columns,
3232
data,
3333
}: DataTableProps<TData>) {

src/components/table-builder.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import {
99
TableRow,
1010
} from "./ui/table"
1111

12-
export default function TableBuilder({
12+
export interface TableBuilderColumnProps {
13+
title: string
14+
options?: React.ComponentProps<typeof TableHead>
15+
}
16+
17+
export function TableBuilder({
1318
columns,
1419
data,
1520
}: {
16-
columns: { title: string; options?: React.ComponentProps<typeof TableHead> }[]
21+
columns: TableBuilderColumnProps[]
1722
data: {
1823
value: ReactNode
1924
options?: React.ComponentProps<typeof TableCell>

src/mdx-components.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import {
1111
import { ExternalLinkIcon } from "lucide-react"
1212
import { CodeBlock, CodeInline } from "renoun/components"
1313

14-
import DataTableBuilder from "./components/data-table-builder"
14+
import { DataTableBuilder } from "./components/data-table-builder"
1515
import MermaidWrapper from "./components/mermaid-wrapper"
1616
import RailroadWrapper from "./components/railroad-wrapper"
17-
import TableBuilder from "./components/table-builder"
17+
import { TableBuilder } from "./components/table-builder"
1818
import { Alert, AlertDescription, AlertTitle } from "./components/ui/alert"
1919
import { Stepper, StepperItem } from "./components/ui/stepper"
2020
import {

0 commit comments

Comments
 (0)