mirror of
https://github.com/dergigi/boris.git
synced 2026-02-16 12:34:41 +01:00
- Add minHeight property to ReadingProgressBar container and inner div - Ensure empty progress bar maintains same 3px height as filled progress bar - Fix visual consistency between empty and filled reading progress states - Maintain proper visual separator thickness in large card view
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import React from 'react'
|
|
|
|
interface ReadingProgressBarProps {
|
|
readingProgress?: number
|
|
height?: number
|
|
marginTop?: string
|
|
marginBottom?: string
|
|
marginLeft?: string
|
|
className?: string
|
|
}
|
|
|
|
export const ReadingProgressBar: React.FC<ReadingProgressBarProps> = ({
|
|
readingProgress,
|
|
height = 1,
|
|
marginTop,
|
|
marginBottom,
|
|
marginLeft,
|
|
className
|
|
}) => {
|
|
// Calculate progress color
|
|
let progressColor = '#6366f1' // Default blue (reading)
|
|
if (readingProgress && readingProgress >= 0.95) {
|
|
progressColor = '#10b981' // Green (completed)
|
|
} else if (readingProgress && readingProgress > 0 && readingProgress <= 0.10) {
|
|
progressColor = 'var(--color-text)' // Neutral text color (started)
|
|
}
|
|
|
|
const progressWidth = readingProgress ? `${Math.round(readingProgress * 100)}%` : '0%'
|
|
const progressBackground = readingProgress ? progressColor : 'var(--color-border)'
|
|
|
|
return (
|
|
<div
|
|
className={className}
|
|
style={{
|
|
height: `${height}px`,
|
|
width: '100%',
|
|
background: 'var(--color-border)',
|
|
borderRadius: '0.5px',
|
|
overflow: 'hidden',
|
|
marginTop,
|
|
marginBottom,
|
|
marginLeft,
|
|
position: 'relative',
|
|
minHeight: `${height}px`
|
|
}}
|
|
>
|
|
<div
|
|
style={{
|
|
height: '100%',
|
|
width: progressWidth,
|
|
background: progressBackground,
|
|
transition: 'width 0.3s ease, background 0.3s ease',
|
|
minHeight: `${height}px`
|
|
}}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|