change layout props to use contentLayout instead of contentClass

This commit is contained in:
fiatcode 2026-01-22 14:40:50 +07:00
parent f354c6c014
commit c3837ef6c8
4 changed files with 5 additions and 6 deletions

View file

@ -6,10 +6,11 @@ import Header from "../components/Header.astro";
interface Props { interface Props {
title: string; title: string;
description: string; description: string;
contentClass?: string; contentLayout?: "default" | "fill-height";
} }
const { title, description, contentClass = "" } = Astro.props; const { title, description, contentLayout = "default" } = Astro.props;
const contentClass = contentLayout === "fill-height" ? "flex-1" : "py-12";
--- ---
<!doctype html> <!doctype html>
@ -24,7 +25,7 @@ const { title, description, contentClass = "" } = Astro.props;
</head> </head>
<body class="h-screen max-w-5xl mx-auto flex flex-col font-sans"> <body class="h-screen max-w-5xl mx-auto flex flex-col font-sans">
<Header /> <Header />
<div class={`w-full max-w-3xl mx-auto ${contentClass ?? ""}`}> <div class={`w-full max-w-3xl mx-auto ${contentClass}`}>
<slot /> <slot />
</div> </div>
<Footer /> <Footer />

View file

@ -7,7 +7,7 @@ import Layout from "../layouts/Layout.astro";
--- ---
<Layout <Layout
contentClass="flex-1" contentLayout="fill-height"
title="Dhemas Nurjaya" title="Dhemas Nurjaya"
description="Welcome to my personal website" description="Welcome to my personal website"
> >

View file

@ -22,7 +22,6 @@ const renderedPost = await render(post);
--- ---
<Layout <Layout
contentClass="py-12"
title={`${post.data.title} - Dhemas Nurjaya`} title={`${post.data.title} - Dhemas Nurjaya`}
description={post.data.description} description={post.data.description}
> >

View file

@ -8,7 +8,6 @@ posts.sort((a, b) => b.data.date.getTime() - a.data.date.getTime());
--- ---
<Layout <Layout
contentClass="py-12"
title="Posts - Dhemas Nurjaya" title="Posts - Dhemas Nurjaya"
description="Read the latest blog posts by Dhemas Nurjaya" description="Read the latest blog posts by Dhemas Nurjaya"
> >