Skip to content

Commit 8142b35

Browse files
committed
timeline 添加样式
1 parent 871fc0b commit 8142b35

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

packages/pure/components/user/Timeline.astro

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@ const { class: className, ...props } = Astro.props
2121

2222
:global(.timeline-list > li) {
2323
margin-top: 0 !important;
24-
margin-bottom: 0 !important;
2524
padding-inline-start: 0 !important;
2625
}
2726

27+
:global(.timeline-list > li:last-child) {
28+
margin-bottom: 0 !important;
29+
}
30+
2831
/* 为 TimelineItem 添加连接线(除了最后一个) */
29-
/* 竖线对齐圆点:从当前圆点中心到下一个圆点中心 */
32+
/* 竖线对齐圆点:从当前圆点底部到下一个圆点顶部 */
3033
:global(.timeline-list > li[data-timeline-item]:not(:last-child)::after) {
3134
content: '';
3235
position: absolute;
3336
left: 14px; /* ms-2 (8px) + 圆圈半径 (6px) = 14px,使竖线在圆圈中心 */
34-
top: 20px; /* 从当前圆点中心开始(pt-0.5 + 圆点中心约20px) */
37+
top: calc(0.125rem + 12px); /* mt-[0.125rem] (2px) + 圆圈高度 (12px) = 14px,从圆点底部开始 */
3538
width: 1px;
36-
height: calc(100% - 20px); /* 延伸到下一个圆点中心 */
39+
height: calc(100% - 14px); /* 延伸到下一个圆点顶部 */
3740
background-color: hsl(var(--border));
3841
z-index: 0;
3942
}
@@ -42,12 +45,11 @@ const { class: className, ...props } = Astro.props
4245
:global(.timeline-list > li[data-milestone="true"]) {
4346
background: linear-gradient(
4447
to right,
45-
hsl(var(--primary) / 0.05),
48+
hsl(var(--primary) / 0.12),
4649
transparent 20%
4750
);
4851
border-radius: 0.375rem;
4952
padding: 0.25rem 0;
50-
margin: 0.125rem 0;
5153
}
5254
</style>
5355

packages/pure/components/user/TimelineItem.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ interface Props {
2323
const { date, class: className, milestone = false } = Astro.props
2424
---
2525

26-
<li class:list={['group relative flex list-none gap-x-3 rounded-full ps-0 sm:gap-x-2', className]} data-timeline-item data-milestone={milestone}>
26+
<li class:list={['group relative flex list-none gap-x-3 rounded-full ps-0 sm:gap-x-2 mb-2', className]} data-timeline-item data-milestone={milestone}>
2727
{/* circle container */}
28-
<div class='relative flex items-start pt-0.5'>
28+
<div class='relative flex items-start'>
2929
{/* circle */}
3030
<span class:list={[
31-
'z-10 ms-2 h-3 w-3 min-w-3 rounded-full border-2 transition-all duration-300',
31+
'z-10 ms-2 mt-[0.125rem] h-3 w-3 min-w-3 rounded-full border-2 transition-all duration-300',
3232
milestone
3333
? 'border-primary bg-primary'
3434
: 'border-muted-foreground bg-background group-hover:border-primary group-hover:scale-110'
3535
]} />
3636
</div>
37-
<div class='flex flex-col gap-0 flex-1 timeline-content py-0.5'>
37+
<div class='flex flex-col gap-0 flex-1 timeline-content'>
3838
<samp class='w-fit rounded-md py-0 text-sm max-sm:bg-primary-foreground max-sm:px-2 sm:min-w-[82px] leading-tight'>
3939
{date}
4040
</samp>

src/pages/about/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ Current support tools as follow:
200200
<TimelineItem date="2025-09-17">
201201
从 <ExternalLink href="https://pages.cloudflare.com"> CloudFlare Pages </ExternalLink> 迁移到 <ExternalLink href="https://edgeone.cloud.tencent.com">Tencent EdgeOne CDN</ExternalLink>
202202
</TimelineItem>
203-
<TimelineItem date="2025-09-16">
203+
<TimelineItem date="2025-09-16" milestone>
204204
添加备案号
205205
</TimelineItem>
206-
<TimelineItem date="2025-07-11">
206+
<TimelineItem date="2025-07-11" milestone>
207207
Website refactored from <ExternalLink href="https://github.com/srleom/astro-theme-resume">Astro Theme Pure</ExternalLink>
208208
</TimelineItem>
209209
</Timeline>

0 commit comments

Comments
 (0)