Status tag and filing
Shows whether a workspace component is a draft or published, and the folder and tags it is filed under.
import { Filing, StatusTag } from "@/pages/library/parts";
import "@/pages/library/library.css"; // for FilingTwo small pieces that sit on every workspace card in the Library. StatusTag says whether the agent may use a component yet. Filing shows where the component is filed, and lets people filter the grid by a tag with one click.
StatusTag
A component in the workspace is a draft until someone publishes it. Only published components are given to the agent, so this is the one thing a card has to say clearly.
<StatusTag status="published" />
<StatusTag status="draft" />status | Renders | Colour |
|---|---|---|
"published" | "Published" | Tag in success-green: --color-tag-success-green (#EBFFF3) fill |
| anything else | "Draft" | Tag in column: --color-tag-column (#EEF0F7) fill |
Both are the small Tag: 10px text on a 16px line, 2px by 8px padding, --radius-md corners, --color-text-primary text.
Any value other than "published", including a typo or undefined, shows "Draft". There is no third state. The Pages tab needs one ("Unpublished changes", in warning-yellow) and the Creatives tab says "Approved", so both render a Tag directly instead of using StatusTag.
Filing
Filing shows a folder with a FolderSimple icon, then the tags. Pass onTag and each tag becomes a button that toggles a filter. The active tag turns blue.
<Filing folder="Demo campaigns" tags={["demo", "product", "q4"]} activeTag={tag} onTag={setTag} />onTag is called with the tag, or with null when the active tag is clicked again. The Library page passes the same tag state to the toolbar, which shows it as a chip.
Read-only
Without onTag the tags are plain text. Either the folder or the tags can be missing. With neither, Filing renders nothing.
<Filing folder="Shared" tags={["every page"]} />
<Filing folder="Launch" />
<Filing tags={["proof", "q4"]} />On a card
How the workspace card puts them together: the category and StatusTag on one line, then the name, the description and Filing.
<div className="lib-card__body">
<div className="lib-card__meta">
<span className="lib-card__category lib-card__category--component"><DiamondsFour size={12} /> Hero</span>
<StatusTag status={item.status} />
</div>
<h3 className="lib-card__name">{item.name}</h3>
<p className="lib-card__text">{item.description}</p>
<Filing folder={item.folder} tags={item.tags} activeTag={tag} onTag={setTag} />
</div>Anatomy of Filing
| Part | Class | Style |
|---|---|---|
| Row | .lib-card__filing | Wrapping flex row, 6px gap, at least 22px tall so cards line up whether or not they have tags. |
| Folder | .lib-folder | 12px secondary text with a 13px FolderSimple icon, 4px gap. |
| Tag | .lib-tag | 11px text on an 18px line, 1px by 8px padding, fully rounded, --color-grey-50 fill, --color-grey-100 border. Hover darkens the border to --color-grey-200. |
| Active tag | .lib-tag--on | --color-primary-50 fill, --color-primary-300 border, --color-primary-700 text. |
| Read-only tag | .lib-tag--static | The same chip with the default cursor. |
Props
StatusTag
| Prop | Type | Default | Notes |
|---|---|---|---|
status | "draft" | "published" | Anything other than "published" shows "Draft". |
Filing
| Prop | Type | Default | Notes |
|---|---|---|---|
folder | string | Shown first, with a folder icon. | |
tags | string[] | [] | Lowercase, as parseTags in src/mocks/library.js stores them. |
activeTag | string | null | The tag currently filtering the grid. It gets .lib-tag--on. | |
onTag | (tag: string | null) => void | Makes the tags buttons. Leave it out for read-only tags. |
Accessibility
StatusTagis text, so "Published" and "Draft" are read out. The colour only repeats what the word says.- Clickable tags are
<button type="button">elements, reachable with Tab. They do not setaria-pressed, so a screen reader cannot tell which tag is active. Only the colour shows it. - The folder icon has no label. The folder name next to it carries the meaning.
Do and don't
- Do use
StatusTagfor anything with the library's draft and published lifecycle: workspace components and the component editor header. - Do pass
onTagon grids that can be filtered, and leave it out where clicking a tag would lead nowhere. - Don't use
StatusTagfor page or creative status. It cannot show "Unpublished changes" or "Approved"; render a Tag with the right colour instead. - Don't write tags in title case. They are stored lowercase and compared exactly.
When to use it
Use these inside the library. Everywhere else, use Tag from @/ui directly. Note that src/pages/workbook/list/WorkbookList.jsx has its own, unrelated StatusTag for workbooks.
Where it is used
| File | What |
|---|---|
src/pages/library/LibraryPage.jsx, WorkspaceCard | StatusTag and a clickable Filing on each workspace component. |
src/pages/library/LibraryPage.jsx, TemplateCard | A clickable Filing on workspace templates. Library templates show none. |
src/pages/library/ComponentEditorPage.jsx | StatusTag in the editor header, next to the component's name. |