81 lines
1.3 KiB
Plaintext
81 lines
1.3 KiB
Plaintext
---
|
|
import type {Post} from "@/types";
|
|
import {formatDatetime} from '@/lib/format.ts'
|
|
|
|
interface Props {
|
|
posts: Post[]
|
|
}
|
|
const {posts} = Astro.props
|
|
---
|
|
|
|
<div class="posts">
|
|
{posts.map(item => (
|
|
<div class="post">
|
|
<span class="d">{formatDatetime(item.published_at, 'YY.MM.DD')}</span>
|
|
<h2><a href=`/post/${item.slug}`>{item.title}</a></h2>
|
|
<span class="arrow">→</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
<style>
|
|
.posts {
|
|
|
|
}
|
|
|
|
.post {
|
|
display: flex;
|
|
align-items: baseline;
|
|
gap: 20px;
|
|
padding: 26px 0;
|
|
border-bottom: 1px solid #e8e8e8;
|
|
}
|
|
|
|
.post .d {
|
|
font-size: 12px;
|
|
color: #b8b8b8;
|
|
min-width: 80px;
|
|
letter-spacing: 0.1em;
|
|
}
|
|
|
|
.post h2 {
|
|
font-size: 16px;
|
|
font-weight: normal;
|
|
flex: 1;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.post h2 a {
|
|
color: #181818;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.post h2 a:hover {
|
|
color: #334155;
|
|
text-decoration: underline;
|
|
text-underline-offset: 6px;
|
|
}
|
|
|
|
.post .arrow {
|
|
color: #d0d0d0;
|
|
font-size: 14px;
|
|
transition: transform 0.2s, color 0.2s;
|
|
}
|
|
|
|
.post:hover .arrow {
|
|
color: #334155;
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
.post .d {
|
|
min-width: 64px;
|
|
}
|
|
|
|
.post h2 {
|
|
font-size: 14px;
|
|
}
|
|
}
|
|
</style>
|