fix: some astro type errors
All checks were successful
Deploy to SFTP Server / build (push) Successful in 23m37s

This commit is contained in:
2024-04-06 18:23:39 +02:00
parent 38a7f83096
commit 613ab7aef9
6 changed files with 61 additions and 46 deletions

View File

@ -7,23 +7,38 @@ type CustomProps = {
layout?: "normal" | "transparent";
backlink?: string;
};
type Props = CollectionEntry<"blog"> & CustomProps;
type Props = CollectionEntry<"blog" | "photos" | "videos" | "projects"> &
CustomProps;
const { headings, data } = Astro.props;
console.log(Astro.props);
const { title, date, links, _layout, backlink = "/blog" } = data;
const { data, backlink = "/" } = Astro.props;
const { title, date, links, _layout } = data;
const path = useTranslatedPath(Astro.url);
---
<Layout title={title}>
<div
class="top-info flex items-center place-content-between opacity-50 m-y-2"
>
<a class="flex items-center gap-1" href={path(backlink)}
<div class="top-info flex items-center place-content-between m-y-2">
<a class="flex items-center gap-1 opacity-50" href={path(backlink)}
><span class="i-tabler-arrow-left"></span> overview</a
>
<div class="date">
{
links?.length && (
<div class="links flex gap-4">
{links.map(([title, url]: string[]) => (
<a href={url} class="flex external items-center gap-[4px]">
{title}
{title === "git" ? (
<span class="i-tabler-brand-git w-4 h-4" />
) : (
<span class="i-tabler-external-link w-4 h-3" />
)}
</a>
))}
</div>
)
}
<div class="date opacity-50">
{
date.toLocaleString("en-US", {
month: "long",
@ -34,51 +49,18 @@ const path = useTranslatedPath(Astro.url);
</div>
</div>
<article class={`layout-${_layout} flex flex-col gap-4`}>
<div class="mb-4 flex flex-col gap-4">
<div class="mb-4 flex flex-col gap-1">
<h1 class="text-4xl">
{title}
</h1>
<div class="toc"></div>
{
links?.length && (
<div class="flex gap-4">
{links.map(([title, url]: string[]) => (
<a href={url} class="flex external items-center gap-[4px]">
{title}
{title === "git" ? (
<span class="i-tabler-brand-git w-4 h-4" />
) : (
<span class="i-tabler-external-link w-4 h-3" />
)}
</a>
))}
</div>
)
}
</div>
<slot />
</article>
</Layout>
<style>
article :global(h2) {
@apply text-3xl;
}
article :global(h3) {
@apply text-2xl;
}
article :global(h4) {
@apply text-xl;
}
article :global(img) {
border-radius: 0.5rem;
}
article.layout-transparent {
padding: 20px;
background: var(--background);

View File

@ -32,6 +32,6 @@ if (!page) {
const { Content } = await page.render();
---
<Post {...page}>
<Post {...page} backlink="/blog">
<Content />
</Post>