refactor(PostPage): 将动画类从PostCard移到外部div

将动画相关的class和style属性从PostCard组件移动到包裹它的div元素,以提高组件结构的清晰度和可维护性
This commit is contained in:
二叉树树
2026-01-03 20:51:19 +08:00
parent 8b976a4605
commit dbb83ab227

View File

@@ -12,17 +12,17 @@ const interval = 50;
<div class="transition flex flex-col rounded-[var(--radius-large)] bg-transparent gap-4 mb-4"> <div class="transition flex flex-col rounded-[var(--radius-large)] bg-transparent gap-4 mb-4">
{page.data.map((entry: CollectionEntry<"posts">) => ( {page.data.map((entry: CollectionEntry<"posts">) => (
<PostCard <div class="onload-animation" style={`animation-delay: calc(var(--content-delay) + ${delay++ * interval}ms);`}>
entry={entry} <PostCard
title={entry.data.title} entry={entry}
published={entry.data.published} title={entry.data.title}
updated={entry.data.updated} published={entry.data.published}
url={getPostUrlBySlug(entry.slug)} updated={entry.data.updated}
image={entry.data.image} url={getPostUrlBySlug(entry.slug)}
description={entry.data.description} image={entry.data.image}
draft={entry.data.draft} description={entry.data.description}
class:list="onload-animation" draft={entry.data.draft}
style={`animation-delay: calc(var(--content-delay) + ${delay++ * interval}ms);`} ></PostCard>
></PostCard> </div>
))} ))}
</div> </div>