feat: add links to entire article header

This commit is contained in:
2023-12-14 13:28:40 +01:00
parent 28a48b752b
commit d5975e9103
3 changed files with 14 additions and 20 deletions

View File

@ -47,29 +47,25 @@ function Title(
{ children, link }: { children: ComponentChildren; link?: string },
) {
const ctx = useContext(HeroContext);
const OuterTag = link ? "a" : "div";
return (
<div
<OuterTag
href={link}
class={`${
ctx.image ? "noisy-gradient" : ""
} after:opacity-90 flex gap-4 items-center ${ctx.image ? "pt-12" : ""}`}
>
<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" }}
>
{children}
{link &&
(
<a
href={link}
target="__blank"
class="p-2 inline-flex"
>
<IconExternalLink />
</a>
)}
<IconExternalLink />}
</h2>
</div>
</OuterTag>
);
}