mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 23:24:22 +01:00
feat: color reading progress filter icons when active
This commit is contained in:
@@ -12,26 +12,32 @@ interface ReadingProgressFiltersProps {
|
|||||||
|
|
||||||
const ReadingProgressFilters: React.FC<ReadingProgressFiltersProps> = ({ selectedFilter, onFilterChange }) => {
|
const ReadingProgressFilters: React.FC<ReadingProgressFiltersProps> = ({ selectedFilter, onFilterChange }) => {
|
||||||
const filters = [
|
const filters = [
|
||||||
{ type: 'all' as const, icon: faAsterisk, label: 'All' },
|
{ type: 'all' as const, icon: faAsterisk, label: 'All', color: undefined },
|
||||||
{ type: 'unopened' as const, icon: faEnvelope, label: 'Unopened' },
|
{ type: 'unopened' as const, icon: faEnvelope, label: 'Unopened', color: undefined },
|
||||||
{ type: 'started' as const, icon: faEnvelopeOpen, label: 'Started' },
|
{ type: 'started' as const, icon: faEnvelopeOpen, label: 'Started', color: 'var(--color-text)' },
|
||||||
{ type: 'reading' as const, icon: faBookOpen, label: 'Reading' },
|
{ type: 'reading' as const, icon: faBookOpen, label: 'Reading', color: '#6366f1' },
|
||||||
{ type: 'completed' as const, icon: faCheckCircle, label: 'Completed' }
|
{ type: 'completed' as const, icon: faCheckCircle, label: 'Completed', color: '#10b981' }
|
||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bookmark-filters">
|
<div className="bookmark-filters">
|
||||||
{filters.map(filter => (
|
{filters.map(filter => {
|
||||||
<button
|
const isActive = selectedFilter === filter.type
|
||||||
key={filter.type}
|
const activeStyle = isActive && filter.color ? { color: filter.color } : undefined
|
||||||
onClick={() => onFilterChange(filter.type)}
|
|
||||||
className={`filter-btn ${selectedFilter === filter.type ? 'active' : ''}`}
|
return (
|
||||||
title={filter.label}
|
<button
|
||||||
aria-label={`Filter by ${filter.label}`}
|
key={filter.type}
|
||||||
>
|
onClick={() => onFilterChange(filter.type)}
|
||||||
<FontAwesomeIcon icon={filter.icon} />
|
className={`filter-btn ${isActive ? 'active' : ''}`}
|
||||||
</button>
|
title={filter.label}
|
||||||
))}
|
aria-label={`Filter by ${filter.label}`}
|
||||||
|
style={activeStyle}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={filter.icon} />
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user