Optimize dynamic route code-splitting and asset prefetching
Карточки cardkanbantask
Kanban Task Card
Карточка задач для Agile-команд с приоритетами и сроками выполнения.
Живое превью
Использование
Скопируйте и вставьте этот код на вашу страницу Astro:
astro
---
import { KanbanTaskCard } from 'astro-component-kit';
---
<TaskKanbanCard task="Update SEO metadata" date="Oct 24" assigneeInitials="MJ" priority="high" /> ---
import { KanbanTaskCard } from 'astro-component-kit';
---
<TaskKanbanCard task="Update SEO metadata" date="Oct 24" assigneeInitials="MJ" priority="high" /> Ручная установка
Если вы не используете пакет npm, создайте файл и вставьте следующий код: src/components/lib/KanbanTaskCard.astro:
astro
---
/**
* TaskKanbanCard — Agile task card with priority labels, progress completion bar, and due date.
*
* @param {string} task - The description of the task being managed.
* @param {string} date - Visual date string indicator (e.g. 'Oct 28').
* @param {string} assigneeInitials - Short initials for the user avatar (e.g. 'MJ').
* @param {'low'|'med'|'high'} priority - Priority tag variant. Default is 'med'.
* @param {number} progress - Task completion percentage (0 - 100). Default is 65.
*/
interface Props {
task?: string;
date?: string;
assigneeInitials?: string;
priority?: 'low' | 'med' | 'high';
progress?: number;
}
const {
task = 'Optimize dynamic route code-splitting and asset prefetching',
date = 'Oct 28',
assigneeInitials = 'MJ',
priority = 'med',
progress = 65,
} = Astro.props;
const priorityLabels = { low: 'Low', med: 'Medium', high: 'High' };
---
<div class="task-card" role="article" aria-label={`Task: ${task}`}>
<div class="task-card__tags">
<span class={`task-card__tag task-card__tag--${priority}`}>
<span class="task-card__tag-dot" aria-hidden="true"></span>
{priorityLabels[priority]}
</span>
<span class="task-card__pct">{progress}%</span>
</div>
<p class="task-card__desc">{task}</p>
<div class="task-card__progress-wrap" role="progressbar" aria-valuenow={progress} aria-valuemin="0" aria-valuemax="100" aria-label="Task progress">
<div class="task-card__progress-bar" style={`width: ${progress}%;`}></div>
</div>
<div class="task-card__footer">
<div class="task-card__date">
<svg class="task-card__date-icon" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
<line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
<span>{date}</span>
</div>
<div class="task-card__assignee" title={`Assigned to ${assigneeInitials}`}>
{assigneeInitials}
</div>
</div>
</div>
<style>
.task-card {
background: rgba(30, 41, 59, 0.7);
backdrop-filter: blur(12px);
padding: var(--sp-4, 1rem);
border-radius: var(--r-md, 12px);
border: 1px solid rgba(255, 255, 255, 0.08);
display: flex;
flex-direction: column;
gap: 0.65rem;
max-width: 320px;
box-sizing: border-box;
transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.task-card:hover {
transform: translateY(-2px);
border-color: rgba(99, 102, 241, 0.35);
box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.5);
}
.task-card__tags {
display: flex;
justify-content: space-between;
align-items: center;
}
.task-card__tag {
font-size: 0.7rem;
font-weight: 700;
padding: 2px 8px;
border-radius: 4px;
display: inline-flex;
align-items: center;
gap: 4px;
}
.task-card__tag-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: currentColor;
}
.task-card__tag--high {
background: rgba(239, 68, 68, 0.12);
color: #f87171;
}
.task-card__tag--med {
background: rgba(245, 158, 11, 0.12);
color: #fbbf24;
}
.task-card__tag--low {
background: rgba(52, 211, 153, 0.12);
color: #34d399;
}
.task-card__pct {
font-size: 0.72rem;
font-weight: 700;
color: var(--c-text-2, #94a3b8);
}
.task-card__desc {
font-size: 0.88rem;
color: var(--c-text-1, #f1f5f9);
margin: 0;
font-weight: 500;
line-height: 1.45;
}
.task-card__progress-wrap {
height: 4px;
background: rgba(255, 255, 255, 0.08);
border-radius: 2px;
overflow: hidden;
}
.task-card__progress-bar {
height: 100%;
background: linear-gradient(90deg, var(--c-primary, #6366f1), var(--c-primary-light, #818cf8));
border-radius: 2px;
}
.task-card__footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 0.35rem;
}
.task-card__date {
display: flex;
align-items: center;
gap: 4px;
font-size: 0.75rem;
color: var(--c-text-2, #94a3b8);
}
.task-card__date-icon {
opacity: 0.75;
}
.task-card__assignee {
width: 24px;
height: 24px;
background: var(--c-primary, #6366f1);
color: #fff;
font-size: 0.65rem;
border-radius: 50%;
display: grid;
place-items: center;
font-weight: 800;
}
</style> ---
/**
* TaskKanbanCard — Agile task card with priority labels, progress completion bar, and due date.
*
* @param {string} task - The description of the task being managed.
* @param {string} date - Visual date string indicator (e.g. 'Oct 28').
* @param {string} assigneeInitials - Short initials for the user avatar (e.g. 'MJ').
* @param {'low'|'med'|'high'} priority - Priority tag variant. Default is 'med'.
* @param {number} progress - Task completion percentage (0 - 100). Default is 65.
*/
interface Props {
task?: string;
date?: string;
assigneeInitials?: string;
priority?: 'low' | 'med' | 'high';
progress?: number;
}
const {
task = 'Optimize dynamic route code-splitting and asset prefetching',
date = 'Oct 28',
assigneeInitials = 'MJ',
priority = 'med',
progress = 65,
} = Astro.props;
const priorityLabels = { low: 'Low', med: 'Medium', high: 'High' };
---
<div class="task-card" role="article" aria-label={`Task: ${task}`}>
<div class="task-card__tags">
<span class={`task-card__tag task-card__tag--${priority}`}>
<span class="task-card__tag-dot" aria-hidden="true"></span>
{priorityLabels[priority]}
</span>
<span class="task-card__pct">{progress}%</span>
</div>
<p class="task-card__desc">{task}</p>
<div class="task-card__progress-wrap" role="progressbar" aria-valuenow={progress} aria-valuemin="0" aria-valuemax="100" aria-label="Task progress">
<div class="task-card__progress-bar" style={`width: ${progress}%;`}></div>
</div>
<div class="task-card__footer">
<div class="task-card__date">
<svg class="task-card__date-icon" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
<line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
<span>{date}</span>
</div>
<div class="task-card__assignee" title={`Assigned to ${assigneeInitials}`}>
{assigneeInitials}
</div>
</div>
</div>
<style>
.task-card {
background: rgba(30, 41, 59, 0.7);
backdrop-filter: blur(12px);
padding: var(--sp-4, 1rem);
border-radius: var(--r-md, 12px);
border: 1px solid rgba(255, 255, 255, 0.08);
display: flex;
flex-direction: column;
gap: 0.65rem;
max-width: 320px;
box-sizing: border-box;
transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.task-card:hover {
transform: translateY(-2px);
border-color: rgba(99, 102, 241, 0.35);
box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.5);
}
.task-card__tags {
display: flex;
justify-content: space-between;
align-items: center;
}
.task-card__tag {
font-size: 0.7rem;
font-weight: 700;
padding: 2px 8px;
border-radius: 4px;
display: inline-flex;
align-items: center;
gap: 4px;
}
.task-card__tag-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: currentColor;
}
.task-card__tag--high {
background: rgba(239, 68, 68, 0.12);
color: #f87171;
}
.task-card__tag--med {
background: rgba(245, 158, 11, 0.12);
color: #fbbf24;
}
.task-card__tag--low {
background: rgba(52, 211, 153, 0.12);
color: #34d399;
}
.task-card__pct {
font-size: 0.72rem;
font-weight: 700;
color: var(--c-text-2, #94a3b8);
}
.task-card__desc {
font-size: 0.88rem;
color: var(--c-text-1, #f1f5f9);
margin: 0;
font-weight: 500;
line-height: 1.45;
}
.task-card__progress-wrap {
height: 4px;
background: rgba(255, 255, 255, 0.08);
border-radius: 2px;
overflow: hidden;
}
.task-card__progress-bar {
height: 100%;
background: linear-gradient(90deg, var(--c-primary, #6366f1), var(--c-primary-light, #818cf8));
border-radius: 2px;
}
.task-card__footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 0.35rem;
}
.task-card__date {
display: flex;
align-items: center;
gap: 4px;
font-size: 0.75rem;
color: var(--c-text-2, #94a3b8);
}
.task-card__date-icon {
opacity: 0.75;
}
.task-card__assignee {
width: 24px;
height: 24px;
background: var(--c-primary, #6366f1);
color: #fff;
font-size: 0.65rem;
border-radius: 50%;
display: grid;
place-items: center;
font-weight: 800;
}
</style>
Краткая информация
- Категория
- Карточки
- Имя файла
KanbanTaskCard.astro- Зависимости
- Нет — чистый Astro + CSS
- Теги
- cardkanbantask