Build the component catalog
Подзадачи: 7 из 1258%
Марк Ильиндо 20 марта
Card
A task card: a status chip, subtask progress spelled "7 of 12", and a due date that turns red only once it has passed.
put this in the header: https://vibeui.ru/c/card-006?lang=en
Подзадачи: 7 из 1258%
Марк Ильиндо 20 марта
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "card-006" (Task Card) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/card-006.json
Registry item: https://vibeui.ru/r/card-006.json
Installs to: components/vibeui/card-006.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
A task card: a status chip, subtask progress spelled "7 of 12", and a due date that turns red only once it has passed.
A board task card: a status chip, subtask progress in numbers and percent, an assignee and a due date. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Card006 } from "@/components/vibeui/card-006"
<Card006 title="Build the catalog" status="doing" done={7} total={12} />
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-card-006-* palette — do not swap it for your theme tokens
- the numbers beside the bar: nobody reads the remainder off a bar's length
- role="progressbar" with aria-valuenow — an unroled bar is invisible to screen readers
- the status as a word, not just a chip colour
- the due date in plain colour until it passes: pre-emptive alarm helps nobody
- the status colour from one variable through color-mix
## 6. You may change
- title, status, done and total
- due — the deadline in words
- assignee — who is on it
- the accent through the accent prop
## 7. Rules
- Lateness is inferred from the due text only in the demo: pass an explicit flag in a project.
- Progress comes from subtasks: with none, drop the bar entirely.
- Four statuses cover a simple board; add a data-status rule for your own process.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.npx shadcn@latest add https://vibeui.ru/r/card-006.jsonhttps://vibeui.ru/r/card-006.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-card-006-*. Серверный: хуков нет. Статус переключается data-status и красит плашку через color-mix от одной переменной. Полоса прогресса объявлена role="progressbar" с aria-valuenow и подписью. Оттенок аватара исполнителя выводится из имени.
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Card006Props = Omit<
ComponentPropsWithoutRef<"article">,
"children" | "title"
> & {
title?: string
status?: "todo" | "doing" | "review" | "done"
done?: number
total?: number
due?: string
assignee?: string
accent?: string
}
// Идея компонента: карточка задачи с прогрессом подзадач. Прогресс подписан
// числами «7 из 12», а не только полосой: по длине полосы никто не назовёт,
// сколько осталось. Срок краснеет только когда он прошёл — заранее пугать
// цветом бессмысленно, дата и так видна.
const STYLES = `
:where([data-vibeui-block="card-006"]){
--vibeui-card-006-bg:oklch(1 0 0);
--vibeui-card-006-fg:oklch(0.22 0.014 265);
--vibeui-card-006-muted:oklch(0.56 0.014 265);
--vibeui-card-006-border:oklch(0.91 0.006 265);
--vibeui-card-006-track:oklch(0.93 0.005 265);
--vibeui-card-006-accent:oklch(0.55 0.17 265);
--vibeui-card-006-late:oklch(0.56 0.19 25);
--vibeui-card-006-status:oklch(0.6 0.014 265);
--vibeui-card-006-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="card-006"]{
display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:18rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-card-006-bg);
border:1px solid var(--vibeui-card-006-border);border-radius:0.875rem;
color:var(--vibeui-card-006-fg);font-family:var(--vibeui-card-006-font);
}
[data-vibeui-block="card-006"][data-status="doing"]{--vibeui-card-006-status:oklch(0.6 0.16 265)}
[data-vibeui-block="card-006"][data-status="review"]{--vibeui-card-006-status:oklch(0.68 0.16 75)}
[data-vibeui-block="card-006"][data-status="done"]{--vibeui-card-006-status:oklch(0.58 0.15 152)}
[data-vibeui-block="card-006"] [data-part="status"]{
display:inline-flex;align-items:center;gap:0.375rem;align-self:flex-start;
height:1.375rem;padding:0 0.5rem;border-radius:9999px;
background:color-mix(in oklab,var(--vibeui-card-006-status) 12%,oklch(1 0 0));
color:color-mix(in oklab,var(--vibeui-card-006-status) 80%,oklch(0.2 0.02 265));
font-size:0.6875rem;font-weight:650;
}
[data-vibeui-block="card-006"] [data-part="dot"]{width:0.375rem;height:0.375rem;border-radius:9999px;background:var(--vibeui-card-006-status)}
[data-vibeui-block="card-006"] [data-part="title"]{margin:0;font-size:0.9375rem;font-weight:650;line-height:1.3}
[data-vibeui-block="card-006"] [data-part="progress"]{display:flex;flex-direction:column;gap:0.3125rem}
[data-vibeui-block="card-006"] [data-part="numbers"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.5rem;
font-size:0.75rem;color:var(--vibeui-card-006-muted);
}
[data-vibeui-block="card-006"] [data-part="percent"]{color:var(--vibeui-card-006-fg);font-weight:650;font-variant-numeric:tabular-nums}
[data-vibeui-block="card-006"] [data-part="track"]{
height:0.375rem;border-radius:9999px;background:var(--vibeui-card-006-track);overflow:hidden;
}
[data-vibeui-block="card-006"] [data-part="fill"]{
height:100%;border-radius:inherit;background:var(--vibeui-card-006-accent);
}
[data-vibeui-block="card-006"] [data-part="foot"]{
display:flex;align-items:center;justify-content:space-between;gap:0.5rem;
font-size:0.75rem;color:var(--vibeui-card-006-muted);
}
/* Срок краснеет только после того, как прошёл: заранее цвет ничего не даёт. */
[data-vibeui-block="card-006"] [data-part="due"][data-late="true"]{color:var(--vibeui-card-006-late);font-weight:650}
[data-vibeui-block="card-006"] [data-part="assignee"]{display:inline-flex;align-items:center;gap:0.375rem}
[data-vibeui-block="card-006"] [data-part="face"]{
display:flex;align-items:center;justify-content:center;flex:none;
width:1.375rem;height:1.375rem;border-radius:9999px;
background:oklch(0.92 0.05 var(--vibeui-card-006-hue,250));
color:oklch(0.38 0.09 var(--vibeui-card-006-hue,250));
font-size:0.625rem;font-weight:700;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="card-006"] *{animation:none!important;transition:none!important}}
`
const STATUS_TEXT = {
todo: "В очереди",
doing: "В работе",
review: "На проверке",
done: "Готово",
}
function hue(name: string) {
let hash = 2166136261
for (const symbol of name) {
hash ^= symbol.codePointAt(0)!
hash = Math.imul(hash, 16777619)
}
return ((hash >>> 0) % 12) * 30
}
function initials(name: string) {
return name
.split(" ")
.slice(0, 2)
.map((part) => part[0]?.toUpperCase() ?? "")
.join("")
}
/**
* Карточка задачи: статус, прогресс подзадач числами и срок.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Card006({
title = "Собрать каталог компонентов",
status = "doing",
done = 7,
total = 12,
due = "до 20 марта",
assignee = "Марк Ильин",
accent,
className,
style,
...props
}: Card006Props) {
const percent = total > 0 ? Math.round((done / total) * 100) : 0
const palette = {
"--vibeui-card-006-hue": hue(assignee),
...(accent ? { "--vibeui-card-006-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-card-006" precedence="medium">
{STYLES}
</style>
<article
{...props}
data-vibeui-block="card-006"
data-status={status}
className={className}
style={palette}
>
<span data-part="status">
<span data-part="dot" aria-hidden="true" />
{STATUS_TEXT[status]}
</span>
<h3 data-part="title">{title}</h3>
<div data-part="progress">
<p data-part="numbers">
<span>
Подзадачи: {done} из {total}
</span>
<span data-part="percent">{percent}%</span>
</p>
<div
data-part="track"
role="progressbar"
aria-valuenow={percent}
aria-valuemin={0}
aria-valuemax={100}
aria-label={`Готово ${done} из ${total} подзадач`}
>
<div data-part="fill" style={{ width: `${percent}%` }} />
</div>
</div>
<p data-part="foot">
<span data-part="assignee">
<span data-part="face" aria-hidden="true">
{initials(assignee)}
</span>
{assignee}
</span>
<span
data-part="due"
data-late={status !== "done" && due.includes("вчера")}
>
{due}
</span>
</p>
</article>
</>
)
}