refactor: v2

This commit is contained in:
2026-08-15 20:55:56 +08:00
parent 990d4b0728
commit 560f6f29ea
37 changed files with 687 additions and 1506 deletions

View File

@@ -1,37 +1,70 @@
---
import type {Post} from "@/types/post";
import PostItem from '@/components/Post/Item.astro'
import type {Post} from "@/types";
import {formatDatetime} from '@/lib/format.ts'
interface Props {
posts: Post[]
}
const {posts} = Astro.props
---
<section class="section">
<div class="post-list">
{posts.map(post => (
<PostItem post={post}/>
))}
</div>
</section>
<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>
.section {
flex: 1;
height: 100%;
.posts {
}
.post-list {
.post {
display: flex;
flex-direction: column;
align-items: baseline;
gap: 20px;
padding: 26px 0;
border-bottom: 1px solid #e8e8e8;
}
@media (max-width: 860px){
.post-list{
gap: 12px;
}
.post .d {
font-size: 12px;
color: #b8b8b8;
min-width: 80px;
letter-spacing: 0.1em;
}
.post h2 {
font-size: 17px;
font-weight: 500;
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;
}
</style>