Fix dead and miswired props in shared UI/card components (#2827)

This commit is contained in:
Bartosz-Do
2026-08-07 23:53:42 +02:00
committed by GitHub
parent 833e826988
commit 0549900471
7 changed files with 16 additions and 21 deletions
+2 -4
View File
@@ -1,5 +1,4 @@
---
// NOTE: widgets page passes `value=` but only `percentage` (default 20) drives the bar — `value` is accepted but ignored.
import Progress from '@ui/Progress.astro'
import AvatarList from '@ui/AvatarList.astro'
import Icon from '@ui/Icon.astro'
@@ -13,15 +12,14 @@ interface Props {
percentage?: number | string
percentageColor?: string
due?: string
/** unused — see note above */
value?: number | string
}
const { title = 'Task Title', badge, offset = 40, limit = 7, percentage = 20, percentageColor = 'green', due = '2 days' } = Astro.props
const { title = 'Task Title', badge, offset = 40, limit = 7, percentage, percentageColor = 'green', due = '2 days', value = 20 } = Astro.props
---
<div class="card">
<Progress value={percentage} class="card-progress" color={percentageColor} />
<Progress value={percentage ?? value} class="card-progress" color={percentageColor} />
<div class="card-body">
<CardTitle>
<a href="#">{title}</a>
@@ -1,5 +1,4 @@
---
// NOTE: `days-ago` param accepted but unused ("Updated 2 hours ago" is hardcoded).
import Progress from '@ui/Progress.astro'
import CardDropdown from '@ui/CardDropdown.astro'
import projects from '@data/projects.json'
@@ -16,7 +15,7 @@ interface Props {
daysAgo?: number
}
const { projectId = 0, progress = 25 } = Astro.props
const { projectId = 0, progress = 25, daysAgo = 2 } = Astro.props
const project = (projects as Project[])[projectId]
---
@@ -30,7 +29,7 @@ const project = (projects as Project[])[projectId]
<h3 class="card-title mb-1">
<a href="#" class="text-reset">{project.title}</a>
</h3>
<div class="text-secondary">Updated 2 hours ago</div>
<div class="text-secondary">Updated {daysAgo} days ago</div>
<div class="mt-3">
<div class="row g-2 align-items-center">
+1 -3
View File
@@ -1,7 +1,5 @@
---
// person = people[person-id]; the cover photo is photos[person-id].file.
// Base card-cover already carries `card-cover-blurred`; `blurred` adds it a 2nd time
// Base card-cover already carries `card-cover-blurred`; `blurred` adds it a second time.
import Avatar from '@ui/Avatar.astro'
import people from '@data/people.json'
import photos from '@data/photos.json'
@@ -29,7 +27,7 @@ const photo = (photos as Photo[])[personId]
---
<a class="card card-link" href="#">
<div class={`card-cover card-cover-blurred text-center${blurred ? ' card-cover-blurred' : ''}`} style={`background-image: url(./static/photos/${photo.file})`}>
<div class={`card-cover text-center${blurred ? ' card-cover-blurred' : ''}`} style={`background-image: url(./static/photos/${photo.file})`}>
<Avatar size="xl" person={person} thumb />
</div>
<div class="card-body text-center">