Samuel Shuert | 86826b8 | 2024-04-27 16:14:20 -0400 | [diff] [blame^] | 1 | --- |
| 2 | import type { CollectionEntry } from 'astro:content'; |
| 3 | import BaseHead from '../components/BaseHead.astro'; |
| 4 | import Header from '../components/Header.astro'; |
| 5 | import Footer from '../components/Footer.astro'; |
| 6 | import FormattedDate from '../components/FormattedDate.astro'; |
| 7 | |
| 8 | type Props = CollectionEntry<'blog'>['data']; |
| 9 | |
| 10 | const { title, description, pubDate, updatedDate, heroImage } = Astro.props; |
| 11 | --- |
| 12 | |
| 13 | <html lang="en"> |
| 14 | <head> |
| 15 | <BaseHead title={title} description={description} /> |
| 16 | <style> |
| 17 | main { |
| 18 | width: calc(100% - 2em); |
| 19 | max-width: 100%; |
| 20 | margin: 0; |
| 21 | } |
| 22 | .hero-image { |
| 23 | width: 100%; |
| 24 | } |
| 25 | .hero-image img { |
| 26 | display: block; |
| 27 | margin: 0 auto; |
| 28 | border-radius: 12px; |
| 29 | box-shadow: var(--box-shadow); |
| 30 | } |
| 31 | .prose { |
| 32 | width: 720px; |
| 33 | max-width: calc(100% - 2em); |
| 34 | margin: auto; |
| 35 | padding: 1em; |
| 36 | color: rgb(var(--gray-dark)); |
| 37 | } |
| 38 | .title { |
| 39 | margin-bottom: 1em; |
| 40 | padding: 1em 0; |
| 41 | text-align: center; |
| 42 | line-height: 1; |
| 43 | } |
| 44 | .title h1 { |
| 45 | margin: 0 0 0.5em 0; |
| 46 | } |
| 47 | .date { |
| 48 | margin-bottom: 0.5em; |
| 49 | color: rgb(var(--gray)); |
| 50 | } |
| 51 | .last-updated-on { |
| 52 | font-style: italic; |
| 53 | } |
| 54 | </style> |
| 55 | </head> |
| 56 | |
| 57 | <body> |
| 58 | <Header /> |
| 59 | <main> |
| 60 | <article> |
| 61 | <div class="hero-image"> |
| 62 | {heroImage && <img width={1020} height={510} src={heroImage} alt="" />} |
| 63 | </div> |
| 64 | <div class="prose"> |
| 65 | <div class="title"> |
| 66 | <div class="date"> |
| 67 | <FormattedDate date={pubDate} /> |
| 68 | { |
| 69 | updatedDate && ( |
| 70 | <div class="last-updated-on"> |
| 71 | Last updated on <FormattedDate date={updatedDate} /> |
| 72 | </div> |
| 73 | ) |
| 74 | } |
| 75 | </div> |
| 76 | <h1>{title}</h1> |
| 77 | <hr /> |
| 78 | </div> |
| 79 | <slot /> |
| 80 | </div> |
| 81 | </article> |
| 82 | </main> |
| 83 | <Footer /> |
| 84 | </body> |
| 85 | </html> |