Skip to content

Commit

Permalink
refactor: define just props that layout needs
Browse files Browse the repository at this point in the history
  • Loading branch information
bholmesdev committed Oct 31, 2023
1 parent 42cde39 commit f41f44f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 13 additions & 12 deletions templates/studio-template-blog/src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
---
import type { Blog } from "astro:db"
import BaseHead from "../components/BaseHead.astro"
import Footer from "../components/Footer.astro"
import FormattedDate from "../components/FormattedDate.astro"
import Header from "../components/Header.astro"
import BaseHead from '../components/BaseHead.astro';
import Footer from '../components/Footer.astro';
import FormattedDate from '../components/FormattedDate.astro';
import Header from '../components/Header.astro';
type Props = typeof Blog.$inferSelect
type Props = {
title: string;
description: string;
heroImage: string;
publishedAt: Date;
updatedAt?: Date | null;
};
const { title, description, publishedAt, updatedAt, heroImage } = Astro.props
const { title, description, publishedAt, updatedAt, heroImage } = Astro.props;
---

<html lang="en">
Expand Down Expand Up @@ -59,11 +64,7 @@ const { title, description, publishedAt, updatedAt, heroImage } = Astro.props
<main>
<article>
<div class="hero-image">
{
heroImage && (
<img width={1020} height={510} src={heroImage} alt="" />
)
}
<img width={1020} height={510} src={heroImage} alt="" />
</div>
<div class="prose">
<div class="title">
Expand Down
2 changes: 0 additions & 2 deletions templates/studio-template-blog/src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import Layout from '../layouts/BlogPost.astro';
description="Lorem ipsum dolor sit amet"
publishedAt={new Date('August 08 2021')}
heroImage="/blog-placeholder-about.jpg"
updatedAt={null}
heroImage={null}
>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
Expand Down

0 comments on commit f41f44f

Please sign in to comment.