feat: add links to entire article header
This commit is contained in:
parent
28a48b752b
commit
d5975e9103
@ -47,29 +47,25 @@ function Title(
|
|||||||
{ children, link }: { children: ComponentChildren; link?: string },
|
{ children, link }: { children: ComponentChildren; link?: string },
|
||||||
) {
|
) {
|
||||||
const ctx = useContext(HeroContext);
|
const ctx = useContext(HeroContext);
|
||||||
|
|
||||||
|
const OuterTag = link ? "a" : "div";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<OuterTag
|
||||||
|
href={link}
|
||||||
class={`${
|
class={`${
|
||||||
ctx.image ? "noisy-gradient" : ""
|
ctx.image ? "noisy-gradient" : ""
|
||||||
} after:opacity-90 flex gap-4 items-center ${ctx.image ? "pt-12" : ""}`}
|
} after:opacity-90 flex gap-4 items-center ${ctx.image ? "pt-12" : ""}`}
|
||||||
>
|
>
|
||||||
<h2
|
<h2
|
||||||
class="relative text-4xl font-bold z-10"
|
class="flex gap-2 items-center text-4xl font-bold z-10"
|
||||||
style={{ color: ctx.image ? "#1F1F1F" : "white" }}
|
style={{ color: ctx.image ? "#1F1F1F" : "white" }}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
{link &&
|
{link &&
|
||||||
(
|
<IconExternalLink />}
|
||||||
<a
|
|
||||||
href={link}
|
|
||||||
target="__blank"
|
|
||||||
class="p-2 inline-flex"
|
|
||||||
>
|
|
||||||
<IconExternalLink />
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</OuterTag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
lib/cache/image.ts
vendored
2
lib/cache/image.ts
vendored
@ -178,6 +178,6 @@ export async function setImage(
|
|||||||
? { suffix: opts.suffix }
|
? { suffix: opts.suffix }
|
||||||
: { width: opts.width, height: opts.height }),
|
: { width: opts.width, height: opts.height }),
|
||||||
}),
|
}),
|
||||||
{ expires: 60 * 60 * 24 },
|
{ expires: 60 * 60 * 24 * 7 /* 1 week */ },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { LayoutProps } from "$fresh/server.ts";
|
import { PageProps } from "$fresh/server.ts";
|
||||||
import { resources } from "@lib/resources.ts";
|
import { resources } from "@lib/resources.ts";
|
||||||
import { CSS, KATEX_CSS } from "https://deno.land/x/gfm@0.2.5/mod.ts";
|
import { CSS, KATEX_CSS } from "https://deno.land/x/gfm@0.2.5/mod.ts";
|
||||||
import { Head, Partial } from "$fresh/runtime.ts";
|
import { Head } from "$fresh/runtime.ts";
|
||||||
import { Emoji } from "@components/Emoji.tsx";
|
import { Emoji } from "@components/Emoji.tsx";
|
||||||
|
|
||||||
export default function MyLayout({ Component }: LayoutProps) {
|
export default function MyLayout({ Component }: PageProps) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class="md:grid mx-auto"
|
class="md:grid mx-auto"
|
||||||
@ -14,7 +14,7 @@ export default function MyLayout({ Component }: LayoutProps) {
|
|||||||
<style>{CSS}</style>
|
<style>{CSS}</style>
|
||||||
<style>{KATEX_CSS}</style>
|
<style>{KATEX_CSS}</style>
|
||||||
</Head>
|
</Head>
|
||||||
<aside class="p-4 hidden md:block" f-client-nav>
|
<aside class="p-4 hidden md:block">
|
||||||
<nav class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0">
|
<nav class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0">
|
||||||
{Object.values(resources).map((m) => {
|
{Object.values(resources).map((m) => {
|
||||||
return (
|
return (
|
||||||
@ -32,9 +32,7 @@ export default function MyLayout({ Component }: LayoutProps) {
|
|||||||
class="py-5"
|
class="py-5"
|
||||||
style={{ fontFamily: "Work Sans" }}
|
style={{ fontFamily: "Work Sans" }}
|
||||||
>
|
>
|
||||||
<Partial name="content">
|
<Component />
|
||||||
<Component />
|
|
||||||
</Partial>
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user