-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to Lume's built-in component system for better reload support
- Loading branch information
Showing
5 changed files
with
34 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
import { clsx } from "@nick/clsx"; | ||
import { MetadataSchema } from "../lib/metadata.ts"; | ||
import {clsx} from "@nick/clsx"; | ||
import {z} from "https://deno.land/x/[email protected]/mod.ts"; | ||
import {MetadataSchema} from "../lib/metadata.ts"; | ||
|
||
export interface AsideProps { | ||
data: Lume.Data; | ||
hide?: boolean; | ||
} | ||
|
||
export function Aside({ data, hide }: AsideProps) { | ||
const PropsSchema = z.object({ | ||
data: z.object({ | ||
url: z.string(), | ||
page: z.object({ | ||
data: z.object({ | ||
vos: z.record(z.string(), MetadataSchema), | ||
}), | ||
}), | ||
}), | ||
hide: z.boolean().default(false), | ||
}); | ||
|
||
export default function (props: z.input<typeof PropsSchema>) { | ||
const {data, hide} = PropsSchema.parse(props); | ||
|
||
const liStyle = (targetUrl: string) => | ||
clsx( | ||
"block p-3 hover:bg-gray-100", | ||
|
@@ -15,7 +30,7 @@ export function Aside({ data, hide }: AsideProps) { | |
|
||
return ( | ||
<aside className={asideClass(hide ?? false)}> | ||
<a href="/"> | ||
<a href="/" className="block"> | ||
<img | ||
src="/assets/logo.svg" | ||
alt="WüSpace" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
export interface PreviewProps { | ||
src: string; | ||
} | ||
import {z} from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
export interface PreviewOptions { | ||
page?: number; | ||
|
@@ -20,7 +18,13 @@ function buildViewerUrl(src: string, options: PreviewOptions = defaultOptions) { | |
return `/pdfjs/web/viewer.html?file=${encodedSrc}#zoom=${zoom}&page=${page}&pagemode=${pagemode}`; | ||
} | ||
|
||
export function Preview({ src }: PreviewProps) { | ||
const PropsSchema = z.object({ | ||
src: z.string(), | ||
}); | ||
|
||
export default function (props: z.input<typeof PropsSchema>) { | ||
const {src} = PropsSchema.parse(props); | ||
|
||
return ( | ||
<iframe | ||
src={buildViewerUrl(src)} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
import { Aside } from "./_components/Aside.tsx"; | ||
|
||
export const layout = "index.tsx"; | ||
export const title = "WüSpace VOS: Satzung und Vereinsordnungen des WüSpace e. V."; | ||
|
||
export default function Index({ vos, ...data }: Lume.Data, helpers: Lume.Helpers) { | ||
export default function Index({ comp, ...data }: Lume.Data) { | ||
return <> | ||
<Aside data={data} /> | ||
<comp.Aside data={data} /> | ||
<main className="justify-center flex-1 hidden text-gray-100 bg-gray-700 place-items-center md:flex"> | ||
<p className="text-2xl text-center"> | ||
← VO auswählen. | ||
</p> | ||
</main> | ||
|
||
</> | ||
} |