feat: 首页改版

This commit is contained in:
2026-07-20 22:14:20 +08:00
parent 95320835b6
commit a5f4d0a28d
16 changed files with 359 additions and 130 deletions

View File

@@ -0,0 +1,87 @@
---
import Folder from "@/assets/icon/folder.png?url";
import type {CategoriesStats} from "@/types";
interface Props {
categories: CategoriesStats[]
}
const {categories} = Astro.props
---
<aside class="sidebar">
<div class="widget">
<h3 class="widget-title">
<img src={Folder} alt="Folder">
文章分类
</h3>
<ul class="category-list">
{
categories.map((category) => (
<li>
<a>{category.name}</a><span class="count">{category.post_count}</span>
</li>
))
}
</ul>
</div>
</aside>
<style>
.sidebar {
width: 300px;
height: 100%;
}
.widget {
background: var(--card-bg);
border-radius: 12px;
box-shadow: var(--shadow);
padding: 22px;
}
.widget-title {
font-size: 16px;
font-weight: 700;
margin-bottom: 16px;
padding-bottom: 10px;
border-bottom: 1px solid var(--border);
display: flex;
gap: 8px;
}
.widget-title img {
width: 18px;
height: 18px;
}
/* 分类 & 标签云 */
.category-list {
list-style: none;
}
.category-list li {
display: flex;
justify-content: space-between;
padding: 8px 4px;
font-size: 14px;
border-bottom: 1px dashed var(--border);
}
.category-list li:last-child {
border-bottom: none;
}
.category-list a:hover {
color: var(--primary);
}
.category-list .count {
color: var(--text-secondary);
font-size: 13px;
}
@media (max-width: 860px) {
.sidebar{
width: 100%;
}
}
</style>