Fix TypeScript errors
This commit is contained in:
parent
e55dd81c15
commit
f35c21a8c0
10 changed files with 137 additions and 66 deletions
|
@ -1,24 +1,20 @@
|
|||
interface Props {
|
||||
post: any;
|
||||
}
|
||||
|
||||
export default function (props: Props) {
|
||||
export default function (data: Lume.Data) {
|
||||
return (
|
||||
<li className="post-list-item">
|
||||
<a href={props.post.data.url} className="post-list-title">
|
||||
{props.post.data.title}
|
||||
<a href={data.post.data.url} className="post-list-title">
|
||||
{data.post.data.title}
|
||||
</a>
|
||||
<time className="post-list-date">
|
||||
{Intl.DateTimeFormat("en-CA", { dateStyle: "long" }).format(
|
||||
props.post.data.date,
|
||||
data.post.data.date,
|
||||
)}
|
||||
</time>
|
||||
<ul className="tag-list">
|
||||
{props.post.data.tags.map((tag, index) => (
|
||||
{data.post.data.tags.map((tag: string, index: number) => (
|
||||
<li key={index} className="tag">{tag}</li>
|
||||
))}
|
||||
</ul>
|
||||
<p className="post-list-description">{props.post.data.description}</p>
|
||||
<p className="post-list-description">{data.post.data.description}</p>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default function ({ comp }) {
|
||||
export default function ({ comp }: Lume.Data) {
|
||||
const iconStyle = {
|
||||
filter: "var(--filter-fg)",
|
||||
};
|
||||
|
|
|
@ -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 (
|
||||
|
|
20
_config.ts
20
_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");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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 (
|
||||
<html lang="en-CA">
|
||||
|
|
|
@ -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 &&
|
||||
|
|
|
@ -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 (
|
||||
<div className="no-posts">
|
||||
|
@ -32,9 +22,17 @@ export default function ({ nav, comp }) {
|
|||
|
||||
return (
|
||||
<ul className="post-list">
|
||||
{nav.menu("/blog/posts").children.sort(sortPosts).map((post, index) => (
|
||||
<PostListItem key={index} post={post} />
|
||||
))}
|
||||
{nav.menu("/blog/posts")?.children?.sort((a, b) => {
|
||||
let result = 0;
|
||||
if (a.data && b.data) {
|
||||
if (a.data.date < b.data.date) {
|
||||
result = 1;
|
||||
} else if (a.data.date > b.data.date) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}).map((post, index) => <PostListItem key={index} post={post} />)}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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": [
|
||||
|
|
66
deno.lock
generated
66
deno.lock
generated
|
@ -3,6 +3,7 @@
|
|||
"packages": {
|
||||
"specifiers": {
|
||||
"jsr:@davidbonnet/astring@1.8.6": "jsr:@davidbonnet/astring@1.8.6",
|
||||
"jsr:@libs/typing@2": "jsr:@libs/typing@2.9.0",
|
||||
"jsr:@std/assert@^0.224.0": "jsr:@std/assert@0.224.0",
|
||||
"jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0",
|
||||
"jsr:@std/cli@0.224.7": "jsr:@std/cli@0.224.7",
|
||||
|
@ -35,6 +36,7 @@
|
|||
"jsr:@std/http@0.224.5": "jsr:@std/http@0.224.5",
|
||||
"jsr:@std/io@^0.224.2": "jsr:@std/io@0.224.2",
|
||||
"jsr:@std/io@^0.224.3": "jsr:@std/io@0.224.3",
|
||||
"jsr:@std/json@^1.0.0-rc.1": "jsr:@std/json@1.0.0",
|
||||
"jsr:@std/jsonc@0.224.3": "jsr:@std/jsonc@0.224.3",
|
||||
"jsr:@std/log@0.224.3": "jsr:@std/log@0.224.3",
|
||||
"jsr:@std/log@0.224.4": "jsr:@std/log@0.224.4",
|
||||
|
@ -55,6 +57,10 @@
|
|||
"jsr:@std/yaml@^0.224.1": "jsr:@std/yaml@0.224.2",
|
||||
"jsr:@std/yaml@^1.0.0-rc.1": "jsr:@std/yaml@1.0.0-rc.1",
|
||||
"npm:@js-temporal/polyfill@0.4.4": "npm:@js-temporal/polyfill@0.4.4",
|
||||
"npm:@types/estree@1.0.5": "npm:@types/estree@1.0.5",
|
||||
"npm:@types/react": "npm:@types/react@18.3.3",
|
||||
"npm:@types/react-dom@18.3.0": "npm:@types/react-dom@18.3.0",
|
||||
"npm:@types/react@18.3.3": "npm:@types/react@18.3.3",
|
||||
"npm:estree-walker@3.0.3": "npm:estree-walker@3.0.3",
|
||||
"npm:highlight.js": "npm:highlight.js@11.9.0",
|
||||
"npm:highlight.js@11.10.0": "npm:highlight.js@11.10.0",
|
||||
|
@ -63,6 +69,9 @@
|
|||
"npm:markdown-it-deflist@3.0.0": "npm:markdown-it-deflist@3.0.0",
|
||||
"npm:markdown-it@14.1.0": "npm:markdown-it@14.1.0",
|
||||
"npm:meriyah@4.5.0": "npm:meriyah@4.5.0",
|
||||
"npm:preact": "npm:preact@10.23.2",
|
||||
"npm:preact-render-to-string@6.5.6": "npm:preact-render-to-string@6.5.6_preact@10.22.1",
|
||||
"npm:preact@10.22.1": "npm:preact@10.22.1",
|
||||
"npm:react": "npm:react@18.3.1",
|
||||
"npm:react-dom@18.3.1": "npm:react-dom@18.3.1_react@18.3.1",
|
||||
"npm:react@18.3.1": "npm:react@18.3.1",
|
||||
|
@ -74,6 +83,9 @@
|
|||
"@davidbonnet/astring@1.8.6": {
|
||||
"integrity": "98b4914c8863cdf8c0ff83bb5c528caa67a8dca6020ad6234113499f00583e3a"
|
||||
},
|
||||
"@libs/typing@2.9.0": {
|
||||
"integrity": "ddf35ea652b807cd9b19b4f3f163fb5d76d57299053753fbd01ba8b02d9306ad"
|
||||
},
|
||||
"@std/assert@0.224.0": {
|
||||
"integrity": "8643233ec7aec38a940a8264a6e3eed9bfa44e7a71cc6b3c8874213ff401967f"
|
||||
},
|
||||
|
@ -182,8 +194,14 @@
|
|||
"@std/io@0.224.3": {
|
||||
"integrity": "b402edeb99c6b3778d9ae3e9927bc9085b170b41e5a09bbb7064ab2ee394ae2f"
|
||||
},
|
||||
"@std/json@1.0.0": {
|
||||
"integrity": "985c1e544918d42e4e84072fc739ac4a19c3a5093292c99742ffcdd03fb6a268"
|
||||
},
|
||||
"@std/jsonc@0.224.3": {
|
||||
"integrity": "c10770a31489f5b85a3562d9b107c497666d8b6a49291ee2711d84da2616c2d6"
|
||||
"integrity": "c10770a31489f5b85a3562d9b107c497666d8b6a49291ee2711d84da2616c2d6",
|
||||
"dependencies": [
|
||||
"jsr:@std/json@^1.0.0-rc.1"
|
||||
]
|
||||
},
|
||||
"@std/log@0.224.3": {
|
||||
"integrity": "601af539ff0c80d117fcb6cab7d9339242872d7f7f5fe4862aaf32152d86b9bf",
|
||||
|
@ -273,6 +291,23 @@
|
|||
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"@types/prop-types@15.7.12": {
|
||||
"integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"@types/react-dom@18.3.0": {
|
||||
"integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==",
|
||||
"dependencies": {
|
||||
"@types/react": "@types/react@18.3.3"
|
||||
}
|
||||
},
|
||||
"@types/react@18.3.3": {
|
||||
"integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==",
|
||||
"dependencies": {
|
||||
"@types/prop-types": "@types/prop-types@15.7.12",
|
||||
"csstype": "csstype@3.1.3"
|
||||
}
|
||||
},
|
||||
"anymatch@3.1.3": {
|
||||
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
||||
"dependencies": {
|
||||
|
@ -307,6 +342,10 @@
|
|||
"readdirp": "readdirp@3.6.0"
|
||||
}
|
||||
},
|
||||
"csstype@3.1.3": {
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"entities@4.5.0": {
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"dependencies": {}
|
||||
|
@ -422,6 +461,20 @@
|
|||
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"preact-render-to-string@6.5.6_preact@10.22.1": {
|
||||
"integrity": "sha512-msFdv7/ooTV6OIodAnU87V4ct+m2DA1rwaRYV+DNvTYpm/ZInQfoGrcHmbTkV7TOcJaHh5wt1NjiALA46Jyxhw==",
|
||||
"dependencies": {
|
||||
"preact": "preact@10.22.1"
|
||||
}
|
||||
},
|
||||
"preact@10.22.1": {
|
||||
"integrity": "sha512-jRYbDDgMpIb5LHq3hkI0bbl+l/TQ9UnkdQ0ww+lp+4MMOdqaUYdFc5qeyP+IV8FAd/2Em7drVPeKdQxsiWCf/A==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"preact@10.23.2": {
|
||||
"integrity": "sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"punycode.js@2.3.1": {
|
||||
"integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==",
|
||||
"dependencies": {}
|
||||
|
@ -833,6 +886,7 @@
|
|||
"https://deno.land/x/lume@v2.2.4/core/fs.ts": "28e4eb4da6809f8128ce0f1d79a35c405403d10dad223b49faf21d356cef3205",
|
||||
"https://deno.land/x/lume@v2.2.4/core/loaders/binary.ts": "bb1e1cf3faac49f6007dc6814168dc0f633da17356db18e68862e4b2a87a3f33",
|
||||
"https://deno.land/x/lume@v2.2.4/core/loaders/json.ts": "632e840340edf7d79091fb37474a1cbf86dd2d218090fb6f6c0420f5f5e9c2ce",
|
||||
"https://deno.land/x/lume@v2.2.4/core/loaders/mod.ts": "148404b9a9112361918177fcec1456e3e1ccc59baa3812043b6b3dffebbd958d",
|
||||
"https://deno.land/x/lume@v2.2.4/core/loaders/module.ts": "abcb210fa6724b83407407cd0f7ef90462b35a2017bc135a3d124dd7f38843f6",
|
||||
"https://deno.land/x/lume@v2.2.4/core/loaders/text.ts": "42860fc3482651fa6cfba18a734bb548d6e6e1163bf1015c2abc447ab150acbd",
|
||||
"https://deno.land/x/lume@v2.2.4/core/loaders/toml.ts": "72ddfef2deea62815c28e27faa2c5356e09b3109e9547e47a6defea3d3332452",
|
||||
|
@ -882,6 +936,7 @@
|
|||
"https://deno.land/x/lume@v2.2.4/deps/log.ts": "d0b57a4e126597580e4815da6b204b6f1d88cc1ccd8b8c7938ff5722ade4df9b",
|
||||
"https://deno.land/x/lume@v2.2.4/deps/markdown_it.ts": "5da22a23e59f86bb7f0a0aa7c9cb9012a2444b8c3a0896d92a07492626a8c21f",
|
||||
"https://deno.land/x/lume@v2.2.4/deps/path.ts": "3790d802bc4fea222223896ae9cf87455664b707b891b24922cd1ee461ba02c4",
|
||||
"https://deno.land/x/lume@v2.2.4/deps/preact.ts": "0fee3286d49061adc63e65389f3d374dfb714872d210d67dbbc6104976f1f6ff",
|
||||
"https://deno.land/x/lume@v2.2.4/deps/react.ts": "e78c2f0ef668ce2d79ddc040964f76a350ba8703dcc7473f567444e2d5478f14",
|
||||
"https://deno.land/x/lume@v2.2.4/deps/sass.ts": "f71337c96dc08851b1cbe9e95e796246368e1c4a32f81d6c41df37df1a7cbd96",
|
||||
"https://deno.land/x/lume@v2.2.4/deps/temporal.ts": "1958b134c4186b0ab39316fa33ba19d1a4203e2ea445080429d60d296b91a552",
|
||||
|
@ -901,6 +956,7 @@
|
|||
"https://deno.land/x/lume@v2.2.4/plugins/feed.ts": "c3702523ae8507d7d20c5f91635c0dc76e09610aaf1db7cc6af2da484cb7c9e0",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/json.ts": "f6429bbd865e3666ef3385fd205fcc92df02ca2c0f74f20baa5c0798a81e1642",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/jsx.ts": "20ece4ddd348089dd407f184f462f8824b342aef461117257166fd81323f18da",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/jsx_preact.ts": "0059bba926c57e7437da4b403e9e9623c2ff4936904a23fde5297e3db80e3148",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/markdown.ts": "b0f224dcffa0abeb30af178d7ec21f50515c2a7ccd42a3347aac3bea53c4ca27",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/modules.ts": "19a66398a5494f506458e48b8443a7c4700b7577e8fcc0818c39b1d0530c8950",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/nav.ts": "2b3c2f3a26c2ac6d34b870a2bdc211523c8be49aa577b427d30de05512b18b74",
|
||||
|
@ -912,6 +968,7 @@
|
|||
"https://deno.land/x/lume@v2.2.4/plugins/url.ts": "3d298886cb16e1110d427d2f257de6c2ae0da3cd7076b6abcbbd41e7536ed094",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/vento.ts": "d4a1d30c403e0978cdb888fec156d262a60ab40cd73cedfe13d210824ce5d881",
|
||||
"https://deno.land/x/lume@v2.2.4/plugins/yaml.ts": "21b1604304240d4de42b2ba0fcfd81b8330fcff8b365a1ee4ff164de6ef3de75",
|
||||
"https://deno.land/x/lume@v2.2.4/types.ts": "516bec311f10083c5b1d8109e8afd17f02b49cc62c45dca53706f286cb855dba",
|
||||
"https://deno.land/x/lume_init@v0.2.4/deps.ts": "63615f5a253b18494560df31158a13508869dd53eff9f58155dd965d8e01245a",
|
||||
"https://deno.land/x/lume_init@v0.2.4/init.ts": "73c671cb71e7ba82dd47813752272f6cd4b1c4511420bd36ee876bb483b12248",
|
||||
"https://deno.land/x/lume_init@v0.2.4/mod.ts": "8f02778efdcc5e59218acdefa1c7bb9bb5032d7d0041f480555c1b184fdeeccf",
|
||||
|
@ -948,6 +1005,12 @@
|
|||
"https://deno.land/x/lume_markdown_plugins@v0.6.0/toc/anchors.ts": "8a4a1c6b2c63156622695ceba57fa7100a6e5f109c9a383a1dcaf755233c8184",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.6.0/toc/mod.ts": "8c7aa6e1dcfabda4264503495a3875388108cd9a5a94b54853b45a8e8cba9f78",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.6.0/utils.ts": "6e6c3c394709eff39080562732c2dafe404f225253aaded937133ea694c4b735",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.7.1/footnotes.ts": "2e31ea45e68ce2156dcde85e83dd96d8285a0aede1aaa700bd7211b454d86544",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.7.1/footnotes/mod.ts": "3e36f09f4cb41c0c11921c2803ab2d29756971f1287a1b097918ce6c0c24303a",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.7.1/toc.ts": "1fe2769056a022303b3871fc4b7be26b7738d44a31e5fd08debd527e9dc49ecc",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.7.1/toc/anchors.ts": "8a4a1c6b2c63156622695ceba57fa7100a6e5f109c9a383a1dcaf755233c8184",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.7.1/toc/mod.ts": "8c7aa6e1dcfabda4264503495a3875388108cd9a5a94b54853b45a8e8cba9f78",
|
||||
"https://deno.land/x/lume_markdown_plugins@v0.7.1/utils.ts": "6e6c3c394709eff39080562732c2dafe404f225253aaded937133ea694c4b735",
|
||||
"https://deno.land/x/vento@v0.12.7/deps.ts": "6ffd42d0cc08195c8eef60fd4c5a56d47287d508928c1eafdb1eaa1c34da741f",
|
||||
"https://deno.land/x/vento@v0.12.7/mod.ts": "1c226f165e6c995bcb0f68b7d78623c263ea7bc3e0dae131617fd053703bc742",
|
||||
"https://deno.land/x/vento@v0.12.7/plugins/echo.ts": "f7c064fb6d34b29852f46f6e01583ed87656dcbbc5cae51c8f29198d6951d0cf",
|
||||
|
@ -1008,6 +1071,7 @@
|
|||
"https://deno.land/x/vento@v1.12.10/src/loader.ts": "c05add67f582e937ee611852075ce2cc038b5e80e3e609eef96fa5ed74a5086c",
|
||||
"https://deno.land/x/vento@v1.12.10/src/tokenizer.ts": "e7830fbc644a3b30cf852d0685f9797e4826ad399a3e0277beebce577b54934c",
|
||||
"https://deno.land/x/vento@v1.12.10/src/transformer.ts": "587a0b107a2bd1437a3093c4c44c07e4fdf3abfaaf8e845767b69bd34a039154",
|
||||
"https://deno.land/x/xml@5.4.12/_types.ts": "493c293e61bd2be051c377d4e6389d9f4e17403e70e4f0de25599b86265efc80",
|
||||
"https://deno.land/x/xml@5.4.12/mod.ts": "b59e5c0dd9fe7ed597c21c39aacf089aa82fe5c5eaad3f411a43a9c104359f4e",
|
||||
"https://deno.land/x/xml@5.4.12/parse.ts": "af704c72d42607d5b3f364972c413e05b6d2921d164806ec47aee348cf6ce49c",
|
||||
"https://deno.land/x/xml@5.4.12/stringify.ts": "a00881a1e563902538cfea8ce31464c81e98e61dddcf718039d7118b46464687",
|
||||
|
|
34
index.tsx
34
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 (
|
||||
<>
|
||||
<p>
|
||||
|
@ -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.
|
||||
</p>
|
||||
<h2 id="contact-me" tabIndex="-1">
|
||||
<h2 id="contact-me" tabIndex={-1}>
|
||||
<a className="header-anchor" href="#contact-me">Contact Me</a>
|
||||
</h2>
|
||||
<p>
|
||||
|
@ -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 <a href="/gpg-key/">GPG Key</a> page.
|
||||
</p>
|
||||
<h2 id="highlighted-projects" tabIndex="-1">
|
||||
<h2 id="highlighted-projects" tabIndex={-1}>
|
||||
<a className="header-anchor" href="#highlighted-projects">
|
||||
Highlighted Projects
|
||||
</a>
|
||||
|
@ -78,21 +68,31 @@ export default function ({ nav }) {
|
|||
View all projects
|
||||
</a>
|
||||
</p>
|
||||
<h2 id="latest-blog-posts" tabIndex="-1">
|
||||
<h2 id="latest-blog-posts" tabIndex={-1}>
|
||||
<a className="header-anchor" href="#latest-blog-posts">
|
||||
Latest Blog Posts
|
||||
</a>
|
||||
</h2>
|
||||
<ul>
|
||||
{nav.menu("/blog/posts").children.sort(sortPosts).slice(0, 5).map((
|
||||
{data.nav.menu("/blog/posts")?.children?.sort((a, b) => {
|
||||
let result = 0;
|
||||
if (a.data && b.data) {
|
||||
if (a.data.date < b.data.date) {
|
||||
result = 1;
|
||||
} else if (a.data.date > b.data.date) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}).slice(0, 5).map((
|
||||
post,
|
||||
index,
|
||||
) => (
|
||||
<li key={index}>
|
||||
<a href={post.data.url}>{post.data.title}</a> —{" "}
|
||||
<a href={post.data?.url}>{post.data?.title}</a> —{" "}
|
||||
<time className="post-list-date">
|
||||
{Intl.DateTimeFormat("en-CA", { dateStyle: "long" }).format(
|
||||
post.data.date,
|
||||
post.data?.date,
|
||||
)}
|
||||
</time>
|
||||
</li>
|
||||
|
|
Loading…
Add table
Reference in a new issue