Make post component, style list

This commit is contained in:
Cassidy Williams
2022-08-24 00:30:12 -05:00
parent 0af0bcd885
commit 8cf3601874
4 changed files with 45 additions and 14 deletions

24
src/components/Post.astro Normal file
View File

@@ -0,0 +1,24 @@
---
// import Tag from './Tag.astro';
const { slug, title, tags, description, date } = Astro.props;
---
<li>
<a href={`/${slug}/`} class="title">{title}</a>
<time datetime={date}>
{new Date(date).toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric',
})}
</time>
<br />
{description && <span class="excerpt">{description}</span>}
<ul>
{tags && tags.map(tag => (
<li class="tag">
<div>{tag}</div>
</li>
))}
</ul>
</li>