refactor Layout component to remove contentLayout prop and simplify class assignment
This commit is contained in:
parent
80633f89aa
commit
0511d90911
2 changed files with 2 additions and 5 deletions
|
|
@ -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 />
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue