mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-07-03 15:41:26 +00:00
160 lines
3 KiB
Text
160 lines
3 KiB
Text
---
|
|
import "@/styles/global.css";
|
|
import Remark42Count from "@/components/remark42-counter.svelte";
|
|
const data = Astro.props;
|
|
---
|
|
|
|
<li class="post-card">
|
|
<a href={data.url} class="post-link" data-astro-reload>
|
|
<div class="post-text">
|
|
<span class="post-title">{data.title}</span>
|
|
<span class="post-description">{data.description}</span>
|
|
|
|
<div class="post-meta-row">
|
|
<span class="post-date">{data.date}</span>
|
|
<span class="post-stats">
|
|
<span class="post-stat">
|
|
💬 <Remark42Count url={data.postPath} client:idle />
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<img src={data.img} alt={data.title} class="post-image" loading="lazy" />
|
|
</a>
|
|
</li>
|
|
|
|
<div class="section-divider"></div>
|
|
|
|
<style>
|
|
.post-card {
|
|
list-style: none;
|
|
margin: 0 0 1rem 0;
|
|
padding-left: 0;
|
|
}
|
|
|
|
.post-link {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: stretch;
|
|
gap: 1rem;
|
|
width: 100%;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.post-text {
|
|
flex: 1;
|
|
min-width: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
line-height: 1.6;
|
|
min-height: calc(1.6em * 4);
|
|
}
|
|
|
|
.post-title {
|
|
font-family: "Maple Mono", "Maple Mono CN";
|
|
color: inherit;
|
|
font-weight: 700;
|
|
font-size: 1.34rem;
|
|
line-height: 1.6;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 3;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.post-description {
|
|
color: black;
|
|
font-weight: 400;
|
|
font-style: italic;
|
|
}
|
|
|
|
.post-meta-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.9rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.post-date {
|
|
color: gray;
|
|
font-size: 0.95rem;
|
|
white-space: nowrap;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.post-stats {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.7rem;
|
|
color: #6f8090;
|
|
font-size: 0.92rem;
|
|
line-height: 1.6;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.post-stat {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.2rem;
|
|
}
|
|
|
|
.post-image {
|
|
width: calc((1.6em * 4) * 16 / 9);
|
|
height: calc(1.6em * 4);
|
|
aspect-ratio: 16 / 9;
|
|
object-fit: cover;
|
|
object-position: center;
|
|
border-radius: 0.5rem;
|
|
flex-shrink: 0;
|
|
display: block;
|
|
}
|
|
|
|
:global(.dark) .post-description {
|
|
color: #e6e6e6;
|
|
}
|
|
|
|
:global(.dark) .post-stats {
|
|
color: #aab7c4;
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
.post-link {
|
|
display: grid;
|
|
grid-template-columns: 1fr 120px;
|
|
grid-template-areas:
|
|
"title title"
|
|
"desc image"
|
|
"meta image";
|
|
column-gap: 0.75rem;
|
|
row-gap: 0.2rem;
|
|
align-items: start;
|
|
}
|
|
|
|
.post-text {
|
|
display: contents;
|
|
min-height: auto;
|
|
}
|
|
|
|
.post-title {
|
|
grid-area: title;
|
|
-webkit-line-clamp: 2;
|
|
}
|
|
|
|
.post-description {
|
|
grid-area: desc;
|
|
}
|
|
|
|
.post-meta-row {
|
|
grid-area: meta;
|
|
gap: 0.7rem;
|
|
}
|
|
|
|
.post-image {
|
|
grid-area: image;
|
|
width: 120px;
|
|
height: calc(120px * 9 / 16);
|
|
}
|
|
}
|
|
</style>
|