Anna Petrova12 мин
Invites you to the Catalog project
Нужен взгляд на карточки товаров и вычитка описаний перед релизом.
Card
A notification with inline actions: answer without opening it, and after the answer the card stays with a report.
put this in the header: https://vibeui.ru/c/card-007?lang=en
Anna Petrova12 мин
Нужен взгляд на карточки товаров и вычитка описаний перед релизом.
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "card-007" (Notification 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-007.json
Registry item: https://vibeui.ru/r/card-007.json
Installs to: components/vibeui/card-007.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 notification with inline actions: answer without opening it, and after the answer the card stays with a report.
A notification card: sender, headline, two lines of text and a pair of actions that give way to a result line. Zero dependencies, one file.
## 3. How to use it
import { Card007 } from "@/components/vibeui/card-007"
<Card007 from="Anna Petrova" title="Invites you to a project" primaryLabel="Accept" />
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-007-* palette — do not swap it for your theme tokens
- inline actions: half of all notifications need one tap
- a report instead of disappearing: a vanished row reads as lost
- role="status" on the result line — the change has to be heard
- the aria-label on the unread dot: a coloured dot is silent
- clamping the text to two lines so the list stays even
## 6. You may change
- from, title, body and time
- primaryLabel and secondaryLabel
- the report wording after an answer
- the accent through the accent prop
## 7. Rules
- The answer lives in component state only: sending it is the caller's job.
- Destructive actions do not belong in a notification without a confirmation.
- Time is a string like "12 min": compute the elapsed time upstream.
- 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-007.jsonhttps://vibeui.ru/r/card-007.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-card-007-*. Клиентский: "use client". После ответа кнопки заменяются строкой результата с role="status", поэтому смена состояния объявляется скринридеру. Точка непрочитанного помечена aria-label. Оттенок аватара считается из имени отправителя.
The same file your agent installs. Here in case you would rather copy it by hand.
"use client"
import { useState } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Card007Props = Omit<
ComponentPropsWithoutRef<"article">,
"children" | "title"
> & {
from?: string
title?: string
body?: string
time?: string
primaryLabel?: string
secondaryLabel?: string
accent?: string
}
// Идея компонента: карточка уведомления с действиями внутри. Ответить или
// отклонить можно прямо здесь, не открывая письмо: половина уведомлений
// требует одного нажатия. После ответа карточка не исчезает, а показывает,
// что именно произошло — исчезнувшая строка выглядит как потерянная.
const STYLES = `
:where([data-vibeui-block="card-007"]){
--vibeui-card-007-bg:oklch(1 0 0);
--vibeui-card-007-fg:oklch(0.22 0.014 265);
--vibeui-card-007-muted:oklch(0.56 0.014 265);
--vibeui-card-007-border:oklch(0.91 0.006 265);
--vibeui-card-007-accent:oklch(0.55 0.17 265);
--vibeui-card-007-done:oklch(0.55 0.15 152);
--vibeui-card-007-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="card-007"]{
position:relative;display:flex;gap:0.625rem;
width:100%;max-width:21rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-card-007-bg);
border:1px solid var(--vibeui-card-007-border);border-radius:0.875rem;
color:var(--vibeui-card-007-fg);font-family:var(--vibeui-card-007-font);
}
[data-vibeui-block="card-007"] [data-part="face"]{
display:flex;align-items:center;justify-content:center;flex:none;
width:2.25rem;height:2.25rem;border-radius:9999px;
background:oklch(0.92 0.05 var(--vibeui-card-007-hue,250));
color:oklch(0.38 0.09 var(--vibeui-card-007-hue,250));
font-size:0.75rem;font-weight:700;
}
[data-vibeui-block="card-007"] [data-part="body"]{display:flex;flex-direction:column;gap:0.25rem;min-width:0;flex:1}
[data-vibeui-block="card-007"] [data-part="head"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.5rem;
}
[data-vibeui-block="card-007"] [data-part="from"]{font-size:0.8125rem;font-weight:650}
[data-vibeui-block="card-007"] [data-part="time"]{flex:none;font-size:0.6875rem;color:var(--vibeui-card-007-muted)}
[data-vibeui-block="card-007"] [data-part="title"]{margin:0;font-size:0.875rem;font-weight:600;line-height:1.3}
[data-vibeui-block="card-007"] [data-part="text"]{
margin:0;font-size:0.8125rem;line-height:1.4;color:var(--vibeui-card-007-muted);
display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
[data-vibeui-block="card-007"] [data-part="actions"]{display:flex;gap:0.375rem;margin-top:0.25rem}
[data-vibeui-block="card-007"] button{
appearance:none;cursor:pointer;
height:2rem;padding:0 0.75rem;
border:1px solid var(--vibeui-card-007-border);border-radius:0.5rem;
background:transparent;color:inherit;font:inherit;font-size:0.8125rem;font-weight:600;
}
[data-vibeui-block="card-007"] button[data-primary="true"]{
border-color:transparent;background:var(--vibeui-card-007-accent);color:oklch(0.99 0.01 265);
}
[data-vibeui-block="card-007"] button:focus-visible{outline:2px solid var(--vibeui-card-007-accent);outline-offset:2px}
/* После ответа карточка остаётся на месте с отчётом: исчезнувшая строка
читается как потерянная. */
[data-vibeui-block="card-007"] [data-part="result"]{
display:inline-flex;align-items:center;gap:0.375rem;margin-top:0.375rem;
font-size:0.8125rem;font-weight:600;color:var(--vibeui-card-007-done);
}
[data-vibeui-block="card-007"] [data-part="tick"]{
width:0.3125rem;height:0.5625rem;
border-right:2px solid currentColor;border-bottom:2px solid currentColor;
transform:rotate(45deg);
}
[data-vibeui-block="card-007"] [data-part="unread"]{
position:absolute;right:0.75rem;top:0.75rem;
width:0.4375rem;height:0.4375rem;border-radius:9999px;background:var(--vibeui-card-007-accent);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="card-007"] *{animation:none!important;transition:none!important}}
`
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 Card007({
from = "Анна Петрова",
title = "Приглашает в проект «Каталог»",
body = "Нужен взгляд на карточки товаров и вычитка описаний перед релизом.",
time = "12 мин",
primaryLabel = "Принять",
secondaryLabel = "Отклонить",
accent,
className,
style,
...props
}: Card007Props) {
const [answer, setAnswer] = useState<string | null>(null)
const palette = {
"--vibeui-card-007-hue": hue(from),
...(accent ? { "--vibeui-card-007-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-card-007" precedence="medium">
{STYLES}
</style>
<article
{...props}
data-vibeui-block="card-007"
className={className}
style={palette}
>
{answer ? null : <span data-part="unread" aria-label="Не прочитано" />}
<span data-part="face" aria-hidden="true">
{initials(from)}
</span>
<div data-part="body">
<p data-part="head">
<span data-part="from">{from}</span>
<span data-part="time">{time}</span>
</p>
<h3 data-part="title">{title}</h3>
<p data-part="text">{body}</p>
{answer ? (
<p data-part="result" role="status">
<span data-part="tick" aria-hidden="true" />
{answer}
</p>
) : (
<div data-part="actions">
<button
type="button"
data-primary="true"
onClick={() =>
setAnswer(`${primaryLabel}: приглашение принято`)
}
>
{primaryLabel}
</button>
<button
type="button"
onClick={() =>
setAnswer(`${secondaryLabel}: приглашение отклонено`)
}
>
{secondaryLabel}
</button>
</div>
)}
</div>
</article>
</>
)
}