|
2 | 2 | import PageHeader from "$lib/components/layout/page-header/page-header.svelte"; |
3 | 3 | import Toc from "$lib/components/toc/toc.svelte"; |
4 | 4 | import type { Component, ComponentProps } from "svelte"; |
5 | | - import type { TOCEntry } from "$lib/types.js"; |
| 5 | + import type { Contributor, TOCEntry } from "$lib/types.js"; |
6 | 6 | import Metadata from "../metadata.svelte"; |
| 7 | + import ContributorSection from "../contributors-section.svelte"; |
7 | 8 |
|
8 | 9 | let { |
9 | 10 | component, |
| 11 | + componentProps = {}, |
10 | 12 | title, |
11 | 13 | description, |
12 | 14 | toc, |
13 | 15 | metadata = {}, |
| 16 | + contributors = [], |
14 | 17 | }: { |
15 | 18 | component: Component; |
| 19 | + componentProps?: Record<string, unknown>; |
16 | 20 | title: string; |
17 | 21 | description?: string; |
18 | 22 | toc: TOCEntry[]; |
19 | 23 | metadata?: ComponentProps<typeof Metadata>; |
| 24 | + contributors?: Contributor[]; |
20 | 25 | } = $props(); |
21 | 26 |
|
22 | 27 | const PageComponent = $derived(component); |
| 28 | + const tocItems = $derived( |
| 29 | + contributors.length ? [...toc, { title: "Contributors", url: "#contributors" }] : toc |
| 30 | + ); |
23 | 31 | </script> |
24 | 32 |
|
25 | 33 | <Metadata {...metadata} {title} {description} /> |
26 | 34 | <aside class="sticky"> |
27 | 35 | <div class="sticky top-24 hidden pl-16 xl:block"> |
28 | | - <Toc toc={{ items: toc }} /> |
| 36 | + <Toc toc={{ items: tocItems }} /> |
29 | 37 | </div> |
30 | 38 | </aside> |
31 | 39 | <div class="mx-auto"> |
32 | 40 | <aside> |
33 | | - <Toc toc={{ items: toc }} type="mobile" /> |
| 41 | + <Toc toc={{ items: tocItems }} type="mobile" /> |
34 | 42 | </aside> |
35 | 43 | <main class="mx-auto w-full min-w-0 max-w-[640px] pb-12 2xl:max-w-[760px]" id="main-content"> |
36 | 44 | <PageHeader {title} {description} /> |
37 | | - <PageComponent /> |
| 45 | + <PageComponent {...componentProps} /> |
| 46 | + <ContributorSection {contributors} /> |
38 | 47 | </main> |
39 | 48 | </div> |
0 commit comments