fix: position reading progress bar as dividing line in cards

- Move progress indicator between summary and meta sections
- Replace the border-top dividing line with progress bar
- Show 3px progress bar when reading position exists
- Show 1px gray divider when no progress (maintains original look)
- Remove absolute positioning from bottom of card
- Remove border-top from meta section to avoid double lines
This commit is contained in:
Gigi
2025-10-15 22:26:48 +02:00
parent 8f89165711
commit 5e1146b015

View File

@@ -32,7 +32,7 @@ const BlogPostCard: React.FC<BlogPostCardProps> = ({ post, href, level, readingP
<Link <Link
to={href} to={href}
className={`blog-post-card ${level ? `level-${level}` : ''}`} className={`blog-post-card ${level ? `level-${level}` : ''}`}
style={{ textDecoration: 'none', color: 'inherit', position: 'relative' }} style={{ textDecoration: 'none', color: 'inherit' }}
> >
<div className="blog-post-card-image"> <div className="blog-post-card-image">
{post.image ? ( {post.image ? (
@@ -52,7 +52,37 @@ const BlogPostCard: React.FC<BlogPostCardProps> = ({ post, href, level, readingP
{post.summary && ( {post.summary && (
<p className="blog-post-card-summary">{post.summary}</p> <p className="blog-post-card-summary">{post.summary}</p>
)} )}
<div className="blog-post-card-meta">
{/* Reading progress indicator - replaces the dividing line */}
{readingProgress !== undefined && readingProgress > 0 ? (
<div
className="blog-post-reading-progress"
style={{
height: '3px',
width: '100%',
background: 'var(--color-border)',
overflow: 'hidden',
marginTop: '1rem'
}}
>
<div
style={{
height: '100%',
width: `${progressPercent}%`,
background: progressColor,
transition: 'width 0.3s ease, background 0.3s ease'
}}
/>
</div>
) : (
<div style={{
height: '1px',
background: 'var(--color-border)',
marginTop: '1rem'
}} />
)}
<div className="blog-post-card-meta" style={{ borderTop: 'none', paddingTop: '0.75rem' }}>
<span className="blog-post-card-author"> <span className="blog-post-card-author">
<FontAwesomeIcon icon={faUser} /> <FontAwesomeIcon icon={faUser} />
{displayName} {displayName}
@@ -63,31 +93,6 @@ const BlogPostCard: React.FC<BlogPostCardProps> = ({ post, href, level, readingP
</span> </span>
</div> </div>
</div> </div>
{/* Reading progress indicator */}
{readingProgress !== undefined && readingProgress > 0 && (
<div
className="blog-post-reading-progress"
style={{
position: 'absolute',
bottom: 0,
left: 0,
height: '4px',
width: '100%',
background: 'var(--color-border)',
overflow: 'hidden'
}}
>
<div
style={{
height: '100%',
width: `${progressPercent}%`,
background: progressColor,
transition: 'width 0.3s ease, background 0.3s ease'
}}
/>
</div>
)}
</Link> </Link>
) )
} }