feat: 首页改版
This commit is contained in:
87
src/components/IndexSidebar.astro
Normal file
87
src/components/IndexSidebar.astro
Normal 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>
|
||||
Reference in New Issue
Block a user