feat: add logos to category header pages

This commit is contained in:
2026-02-26 16:01:02 -06:00
parent 5b94283498
commit d7d43369dc
2 changed files with 25 additions and 6 deletions

View File

@@ -1,23 +1,39 @@
--- ---
import GoLinkPrimaryButton from '@components/buttons/GoLinkPrimaryButton.astro'; import GoLinkPrimaryButton from '@components/buttons/GoLinkPrimaryButton.astro';
import Logo from '@components/images/Logo.astro';
import { getDirectusImageURL } from '@/support/url';
interface Props { interface Props {
title: string; title: string;
subTitle: string; subTitle: string;
logoExists?: boolean;
logoLight?: string;
logoDark?: string;
btnExists?: boolean; btnExists?: boolean;
btnTitle?: string; btnTitle?: string;
btnURL?: string; btnURL?: string;
} }
const { title, subTitle, btnExists, btnTitle, btnURL } = Astro.props; const { title, subTitle, logoExists, logoLight, logoDark, btnExists, btnTitle, btnURL } = Astro.props;
--- ---
<section class="mx-auto mt-10 px-4 sm:px-6 lg:px-8 lg:pt-10 2xl:max-w-full"> <section class="mx-auto mt-10 px-4 sm:px-6 lg:px-8 lg:pt-10 2xl:max-w-full">
<div class="flex-wrap md:flex md:items-center md:justify-between"> <div class="flex-wrap md:flex md:items-center md:justify-between">
<div class="w-full md:w-auto"> <div class="w-full md:w-auto">
<h1 class="smooth-reveal card-text-header block lg:text-6xl"> <div class="smooth-reveal flex flex-row items-center mb-4">
{title} {logoExists ? (
</h1> <div class="shrink-0 mr-5">
<Logo
srcLight={getDirectusImageURL(logoLight!)}
srcDark={getDirectusImageURL(logoDark!)}
alt={`Logo of ${title}`}
/>
</div>
) : null}
<h1 class="card-text-header block lg:text-6xl">
{title}
</h1>
</div>
<p class="smooth-reveal card-text-header-description mt-4"> <p class="smooth-reveal card-text-header-description mt-4">
{subTitle} {subTitle}
</p> </p>

View File

@@ -1,7 +1,7 @@
--- ---
import { readItems, readSingleton } from '@directus/sdk'; import { readItems, readSingleton } from '@directus/sdk';
import type { Post, Category } from '@lib/directusTypes'; import type { Post } from '@lib/directusTypes';
import HeaderSection from '@components/sections/HeaderSection.astro'; import HeaderSection from '@components/sections/HeaderSection.astro';
import BlogCard from '@components/cards/BlogCard.astro'; import BlogCard from '@components/cards/BlogCard.astro';
@@ -54,8 +54,11 @@ const categoriesPosts = posts
> >
<HeaderSection <HeaderSection
title={category.title} title=`${category.title}`
subTitle={category.description} subTitle={category.description}
logoExists
logoLight={category.logoLight}
logoDark={category.logoDark}
btnExists btnExists
btnTitle="Back to Categories" btnTitle="Back to Categories"
btnURL="/categories" btnURL="/categories"