diff --git a/_components/PostListItem.tsx b/_components/PostListItem.tsx index 06a4098..a339e9b 100644 --- a/_components/PostListItem.tsx +++ b/_components/PostListItem.tsx @@ -1,24 +1,20 @@ -interface Props { - post: any; -} - -export default function (props: Props) { +export default function (data: Lume.Data) { return (
  • - - {props.post.data.title} + + {data.post.data.title} -

    {props.post.data.description}

    +

    {data.post.data.description}

  • ); } diff --git a/_components/footer.tsx b/_components/footer.tsx index 29eec54..3d28065 100644 --- a/_components/footer.tsx +++ b/_components/footer.tsx @@ -1,4 +1,4 @@ -export default function ({ comp }) { +export default function ({ comp }: Lume.Data) { const iconStyle = { filter: "var(--filter-fg)", }; diff --git a/_components/header.tsx b/_components/header.tsx index 104fe4c..ceaaf54 100644 --- a/_components/header.tsx +++ b/_components/header.tsx @@ -1,14 +1,4 @@ -export interface Props { - title: string; - description?: string; - author?: { - name: string; - }; - date: Date; - comp: any; -} - -export default function (props: Props) { +export default function (props: Lume.Data) { const dateFormatted = Intl.DateTimeFormat("en-CA", { dateStyle: "long" }) .format(props.date); return ( diff --git a/_config.ts b/_config.ts index 41919cd..7d48713 100644 --- a/_config.ts +++ b/_config.ts @@ -4,8 +4,8 @@ import nav from "lume/plugins/nav.ts"; import sass from "lume/plugins/sass.ts"; import feed from "lume/plugins/feed.ts"; import code_highlight from "lume/plugins/code_highlight.ts"; -import toc from "https://deno.land/x/lume_markdown_plugins@v0.6.0/toc.ts"; -import footnotes from "https://deno.land/x/lume_markdown_plugins@v0.6.0/footnotes.ts"; +import toc from "lume-markdown-plugins/toc.ts"; +import footnotes from "lume-markdown-plugins/footnotes.ts"; import lang_typescript from "npm:highlight.js/lib/languages/typescript"; import lang_javascript from "npm:highlight.js/lib/languages/javascript"; @@ -63,15 +63,21 @@ site.process([".html"], (pages) => { // NOTE: This is a hack to append a class to JS doctrings so that we // can style them. If only the Hightlight.js plugin could be configured // to do this instead. - page.document?.getElementsByClassName("hljs-comment").forEach( - (codeCommentElement) => { + if (page.document) { + for ( + const codeCommentElement of page.document.getElementsByClassName( + "hljs-comment", + ) + ) { const docStringRegex = /^\/\*\*.*\*\/$/gsm; - const matchResult = codeCommentElement.innerText.match(docStringRegex); + const matchResult = codeCommentElement.textContent?.match( + docStringRegex, + ); if (matchResult) { codeCommentElement.classList.add("docstring"); } - }, - ); + } + } }); }); diff --git a/_includes/layouts/base.tsx b/_includes/layouts/base.tsx index b623569..a2dca1b 100644 --- a/_includes/layouts/base.tsx +++ b/_includes/layouts/base.tsx @@ -1,5 +1,5 @@ export default function ( - { title, description, children, comp, metas, links, author, date }, + { title, description, children, comp, metas, links, author, date }: Lume.Data, ) { return ( diff --git a/_includes/layouts/post.tsx b/_includes/layouts/post.tsx index 02f9633..c1326c9 100644 --- a/_includes/layouts/post.tsx +++ b/_includes/layouts/post.tsx @@ -1,6 +1,22 @@ export const layout = "./base.tsx"; -export default function ({ children, toc, footnotes }) { +interface Data { + toc: { + text: string; + slug: string; + children: { + text: string; + slug: string; + }[]; + }[]; + footnotes: { + refId: string; + content: string; + id: string; + }[]; +} + +export default function ({ children, toc, footnotes }: Data & Lume.Data) { return ( <> {toc.length > 0 && diff --git a/blog/index.tsx b/blog/index.tsx index 8df654b..f270767 100644 --- a/blog/index.tsx +++ b/blog/index.tsx @@ -1,19 +1,9 @@ export const title = "Blog"; export const description = "Hello, stranger. Stay a while and listen."; -export default function ({ nav, comp }) { +export default function ({ nav, comp }: Lume.Data) { const { PostListItem } = comp; - const sortPosts = (a, b) => { - if (a.data.date < b.data.date) { - return 1; - } else if (a.data.date > b.data.date) { - return -1; - } else { - return 0; - } - }; - if (!nav.menu("/blog/posts")) { return (
    @@ -32,9 +22,17 @@ export default function ({ nav, comp }) { return ( ); } diff --git a/deno.json b/deno.json index b70aae6..cd8fbd9 100644 --- a/deno.json +++ b/deno.json @@ -2,21 +2,22 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "npm:react", + "jsxImportSourceTypes": "npm:@types/react", "types": [ - "https://unpkg.com/@types/react@18.2.37/index.d.ts", "lume/types.ts" ] }, "tasks": { "lume": "echo \"import 'lume/cli.ts'\" | deno run --allow-write='.' --allow-read='.' --allow-net='deno.land,cdn.deno.land,esm.sh,0.0.0.0:3000,jsr.io,lumeland.github.io' --allow-sys=networkInterfaces --allow-env='LUME_ENV,LUME_LIVE_RELOAD,LUME_LOGS,LUME_NOCACHE,LUME_DRAFTS' -", "build": "deno task lume", - "check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx", + "check": "deno fmt --check && deno lint && deno check .", "serve": "deno task lume -s", "deploy": "rsync -avh --progress --delete ./_site/ podman:/srv/www/fosterhangdaan.com/" }, "imports": { "react/jsx-runtime": "https://esm.sh/react@18.2.0/jsx-runtime", - "lume/": "https://deno.land/x/lume@v2.2.4/" + "lume/": "https://deno.land/x/lume@v2.2.4/", + "lume-markdown-plugins/": "https://deno.land/x/lume_markdown_plugins@v0.7.1/" }, "fmt": { "exclude": [ diff --git a/deno.lock b/deno.lock index 92fc9c6..8d43b00 100644 Binary files a/deno.lock and b/deno.lock differ diff --git a/index.tsx b/index.tsx index 504acef..68a72c7 100644 --- a/index.tsx +++ b/index.tsx @@ -1,16 +1,6 @@ export const description = "Software developer and open-source enthusiast."; -export default function ({ nav }) { - const sortPosts = (a, b) => { - if (a.data.date < b.data.date) { - return 1; - } else if (a.data.date > b.data.date) { - return -1; - } else { - return 0; - } - }; - +export default function (data: Lume.Data) { return ( <>

    @@ -24,7 +14,7 @@ export default function ({ nav }) { times, I help in the battle for an open web and for user privacy by contributing in the development of free and open-source software.

    -

    +

    Contact Me

    @@ -35,7 +25,7 @@ export default function ({ nav }) { If you'd like an encrypted response, you can send me your GPG public key. You can find mine in the GPG Key page.

    -

    +

    Highlighted Projects @@ -78,21 +68,31 @@ export default function ({ nav }) { View all projects

    -

    +

    Latest Blog Posts