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 { interface Props {
title: string; title: string;
description: string; description: string;
contentLayout?: "default" | "fill-height";
} }
const { title, description, contentLayout = "default" } = Astro.props; const { title, description } = Astro.props;
const contentClass = contentLayout === "fill-height" ? "flex-1" : "py-12";
--- ---
<!doctype html> <!doctype html>
@ -25,7 +23,7 @@ const contentClass = contentLayout === "fill-height" ? "flex-1" : "py-12";
</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 flex-1 py-12">
<slot /> <slot />
</div> </div>
<Footer /> <Footer />

View file

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