refactor Layout component to remove contentLayout prop and simplify class assignment

This commit is contained in:
fiatcode 2026-01-22 15:45:27 +07:00
parent 80633f89aa
commit 0511d90911
2 changed files with 2 additions and 5 deletions

View file

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

View file

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