Action cards
What is waiting on you, each card with its button and a small picture of what it opens. Free and MIT licensed, as HTML, a typed React component or an Astro component, in three styles with light and dark mode.
Need this designed into your product? Book a call
5 reps to go, due Friday.
New dates are ready to be approved.
Drafts are ready to send. Review them.
Install
Add it to your project with the CLI.
HTML, CSS and JS
npx designme add action-cardsReact
npx designme add action-cards --reactAstro
npx designme add action-cards --astroshadcn, React
npx shadcn@latest add https://designme.dev/r/shadcn/action-cards.json shadcn, Astro
npx shadcn@latest add https://designme.dev/r/shadcn/astro/action-cards.json The CLI copies the source into your project, so you own it and can change anything. Where each version lands, what it needs and the shadcn theme bridge: Installation.
About
What it is for and what it does.
Action cards are the next steps from the Sales CRM template's forecast: a row of cards, each saying what is waiting (submit the Q4 commit, move 4 close dates, send 4 follow-ups) with a button that opens it, beside a small picture of what that button leads to. In each picture a pointer glides to the item in focus and presses it, the item changes, and the list scrolls on to the next.
- When an agent has work ready for a person to look at, and each piece should lead straight to where it is done.
- On a dashboard or an overview, above the detail, so the few things that need someone come first.
- When a picture of what the button opens helps people decide where to start.
- Not for a long list of tasks: a table or Approval queue holds those.
- Three cards, each with a title, one muted line and a white outlined button. The buttons show their hover and press; what they open is yours to wire up.
- Each picture is a short list: the item in focus is a window, its neighbours grey slips above and below. A rep's commit ticks in, a new date turns green as it is approved, and a draft turns from Drafted to Sent.
- The three pictures run at different speeds, so they never move together, and the list wraps round without a jump.
- While a mouse rests on the cards their pictures hold where they are, and carry on when it leaves. With reduced motion the pictures stay still on their first item.
- Three across from 900px wide; below that the cards go one under another, the picture beside the words.
- In React,
ActionCardstakescards, each with itstitle,detail,actionlabel,onActionand apicture:commitwith team names,dateswith each deal's old and new date, orfollowwith account names.
- The pictures are
aria-hidden: the title, the line under it and the button say everything. - The buttons are real buttons, reached with Tab in reading order.
- With reduced motion turned on, nothing in the pictures moves.
Usage
Import it in React and drive it from your own state, or place it in an Astro page.
React
import { ActionCards } from '@/components/designme/action-cards/ActionCards';React example
The demo above as a React component, 10 lines you can copy.
'use client';
// The preview from designme.dev, rebuilt from the React component: the Sales CRM forecast's three next steps.
import { ActionCards } from './ActionCards';
import { Demo } from '../lib/Demo';
/* ---------- Action cards: each picture loops by itself, and holds while a mouse rests on the cards ---------- */
export default function ActionCardsDemo() {
return <Demo switcher={null}><ActionCards /></Demo>;
}
Astro
In a page in src/pages. It plays the demo above; change its action-cards.js to show your own data. Attributes like class go on its root element.
---
import ActionCards from '../components/designme/action-cards/ActionCards.astro';
---
<ActionCards />
<ActionCards data-style="soft" class="my-class" />Props
Everything ActionCards takes.
| Prop | Type | What it does |
|---|---|---|
cards | ActionCard[] | The cards, three across from 900px wide. Defaults to the Sales CRM forecast's three |
className | string |
Code
The full source, as the CLI installs it.
ActionCards.tsxReact · 122 lines
'use client';
import { useEffect, useRef, type ReactNode } from 'react';
import { cx } from '../lib/cx';
import { useReducedMotion } from '../lib/hooks';
import { Icon } from '../lib/icons';
import '../designme.css';
import './action-cards.css';
/** What a card's picture shows: the teams whose commits come in, the deals whose close dates move, or the accounts whose drafts go out */
export type ActionCardPicture =
| { kind: 'commit'; teams: string[] }
| { kind: 'dates'; moves: { name: string; was: string; to: string }[] }
| { kind: 'follow'; accounts: string[] };
export interface ActionCard {
id: string;
/** Like "Submit the Q4 commit" */
title: string;
/** The muted line under it, like "5 reps to go, due Friday." */
detail: string;
/** The button's label, like "Review commit" */
action: string;
onAction?: () => void;
picture: ActionCardPicture;
}
export interface ActionCardsProps {
/** The cards, three across from 900px wide. Defaults to the Sales CRM forecast's three */
cards?: ActionCard[];
className?: string;
}
export const ACTION_CARDS: ActionCard[] = [
{ id: 'commit', title: 'Submit the Q4 commit', detail: '5 reps to go, due Friday.', action: 'Review commit', picture: { kind: 'commit', teams: ['Key accounts', 'Growth', 'New business'] } },
{ id: 'dates', title: 'Move 4 close dates', detail: 'New dates are ready to be approved.', action: 'Review dates', picture: { kind: 'dates', moves: [
{ name: 'Renewal', was: 'Nov 25', to: 'Dec 9' }, { name: 'Renewal', was: 'Nov 23', to: 'Dec 11' }, { name: 'Studio seats', was: 'Nov 20', to: 'Dec 15' }, { name: 'Pilot', was: 'Nov 17', to: 'Dec 17' }] } },
{ id: 'follow', title: 'Send 4 follow-ups', detail: 'Drafts are ready to send. Review them.', action: 'Review drafts', picture: { kind: 'follow', accounts: ['Saltmarsh Foods', 'Moss & Ember', 'Marrow & Finch', 'Arbor & Vine'] } }
];
// each picture's pace, by its place in the row: how long an item stays, how long the list takes to move on, how late it starts
const PACE = [{ step: 3600, mv: 700, at: 0 }, { step: 3000, mv: 600, at: 700 }, { step: 4200, mv: 800, at: 1400 }];
const Tick = () => <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg>;
/** The picture's items, each one a window when it's in focus */
function items(p: ActionCardPicture): ReactNode[] {
if (p.kind === 'commit') return p.teams.map((t, i) => (
<><span className="dm-axc-t">{t}</span>{[0, 1].map(r => <span key={r} className="dm-axc-r"><span className="dm-axc-l" style={{ width: [[60, 44], [52, 38], [56, 46]][i % 3][r] + '%' }} /><span className={cx('dm-axc-m', !r && 'dm-in')} data-go={r ? '' : undefined}><Tick /></span></span>)}</>));
if (p.kind === 'dates') return p.moves.map(m => (
<><span className="dm-axc-r"><span className="dm-axc-i" style={{ ['--dm-a' as string]: 'var(--dm-av-r)', ['--dm-ai' as string]: 'var(--dm-av-r-ink)' }}><Icon name="cal" size="xs" /></span><span className="dm-axc-n">{m.name}</span></span>
<span className="dm-axc-d"><s className="dm-num">{m.was}</s><Icon name="right" size="xs" /><span className="dm-tag dm-axc-g dm-num" data-go="">{m.to}</span></span><span className="dm-axc-l" style={{ width: '72%' }} /></>));
return p.accounts.map((a, i) => (
<><span className="dm-axc-r"><span className="dm-axc-i" style={{ ['--dm-a' as string]: 'var(--dm-av-b)', ['--dm-ai' as string]: 'var(--dm-av-b-ink)' }}><Icon name="mail" size="xs" /></span><span className="dm-axc-n">{a}</span></span>
<span className="dm-axc-l" style={{ width: [88, 76, 82, 70][i % 4] + '%' }} /><span className="dm-axc-r"><span className="dm-tag dm-axc-g dm-dr" data-go=""><Icon name="spark" size="xs" /><span className="dm-sw"><span className="dm-a">Drafted</span><span className="dm-b">Sent</span></span></span></span></>));
}
function Card({ card, pace, held }: { card: ActionCard; pace: (typeof PACE)[number]; held: { current: boolean } }) {
const vis = useRef<HTMLDivElement>(null), track = useRef<HTMLDivElement>(null), cur = useRef<SVGSVGElement>(null);
const reduce = useReducedMotion();
const list = items(card.picture), n = list.length;
// the track: the last item first (the slip above), the list, then its first two again so the loop can wrap unseen
const seq = n ? [list[n - 1], ...list, list[0], list[1 % n]] : [];
useEffect(() => {
const v = vis.current, k = track.current, c = cur.current; if (!v || !k || !c || !n) return;
const W = [...k.children] as HTMLElement[];
let i = 1, alive = true;
const timers: ReturnType<typeof setTimeout>[] = [];
const place = (idx: number, anim: boolean) => { k.classList.toggle('dm-mv', anim); const it = W[idx]; k.style.transform = `translateY(${Math.round((v.clientHeight - it.offsetHeight) / 2 - it.offsetTop)}px)`;
W.forEach((x, m) => x.classList.toggle('dm-on', m === idx)); };
place(i, false);
const ro = new ResizeObserver(() => place(i, false)); ro.observe(v);
// a wait that only counts while no mouse rests on the cards
const wait = (ms: number) => new Promise<void>(res => { let left = ms, last = performance.now();
const t = () => { if (!alive) return; const now = performance.now(); if (!held.current) left -= now - last; last = now; if (left <= 0) res(); else timers.push(setTimeout(t, 50)); };
timers.push(setTimeout(t, 50)); });
const at = (el: Element) => { const a = v.getBoundingClientRect(), b = el.getBoundingClientRect(); return [b.left - a.left + b.width * .55, b.top - a.top + b.height * .5]; };
const run = async () => {
await wait(pace.at + 900);
while (alive) {
const go = W[i].querySelector('[data-go]');
if (go) {
const [x, y] = at(go);
c.classList.remove('dm-press'); c.style.transition = 'none'; c.style.transform = `translate(${x + 34}px,${y + 26}px)`; void c.getBoundingClientRect(); c.style.transition = '';
c.style.opacity = '1'; c.style.transform = `translate(${x}px,${y}px)`;
await wait(700); if (!alive) return;
c.classList.add('dm-press'); c.style.transform = `translate(${x}px,${y}px) scale(.8)`;
await wait(140); if (!alive) return;
c.style.transform = `translate(${x}px,${y}px)`; go.classList.add(go.classList.contains('dm-axc-m') ? 'dm-in' : 'dm-ok');
await wait(520); if (!alive) return;
c.classList.remove('dm-press'); c.style.opacity = '0'; c.style.transform = `translate(${x + 18}px,${y + 14}px)`;
}
await wait(Math.max(300, pace.step - 1700)); if (!alive) return;
// scroll up to the next item; past the end, jump back unseen to the same item at the start, all fresh again
i++; place(i, true);
await wait(pace.mv + 60); if (!alive) return;
if (i === n + 1) { i = 1; W.forEach(x => x.querySelectorAll('[data-go]').forEach(g => g.classList.remove('dm-in', 'dm-ok'))); place(i, false); }
}
};
if (!reduce) run();
return () => { alive = false; timers.forEach(clearTimeout); ro.disconnect(); };
}, [n, reduce, pace, held]);
return (
<div className="dm-panel dm-axc-c" data-ax={card.id}>
<div className="dm-axc-tx"><b>{card.title}</b><p>{card.detail}</p><button type="button" className="dm-pill dm-line dm-sm" onClick={card.onAction}>{card.action}</button></div>
<div ref={vis} className="dm-axc-v" aria-hidden="true">
<div ref={track} className="dm-axc-k" style={{ ['--dm-ax-mv' as string]: pace.mv + 'ms' }}>{seq.map((x, j) => <div key={j} className="dm-axc-w">{x}</div>)}</div>
<svg ref={cur} className="dm-axc-cur" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5l12 6.2-5.3 1.5-2.4 5.1z" /></svg>
</div>
</div>
);
}
/** What is waiting on a person, as a row of cards, each with its button and a small looping picture of what it opens, from
the Sales CRM template's forecast. A mouse resting on the cards holds the pictures; with reduced motion they stay still */
export function ActionCards({ cards = ACTION_CARDS, className }: ActionCardsProps) {
const held = useRef(false);
return (
<div className={cx('dm-axc', className)} data-dm="" onPointerEnter={e => { if (e.pointerType === 'mouse') held.current = true; }} onPointerLeave={() => { held.current = false; }}>
<div className="dm-axc-row">{cards.map((c, i) => <Card key={c.id} card={c} pace={PACE[i % PACE.length]} held={held} />)}</div>
</div>
);
}
action-cards.cssReact · 70 lines
/* Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync. */
/* ---------- Action cards ---------- */
/* the Sales CRM forecast's next steps (owner, 27 Nov; designed 16 Nov): each card says what is waiting, with a button that opens
it, beside a small picture of what that button leads to. The picture is a short list: the item in focus is a window, its
neighbours grey slips above and below. In a loop a pointer glides to the item, presses, the item changes (a commit ticks
in, a new date is approved, a draft is sent), then the list scrolls up to the next. The three run at different speeds so
they never move together, a resting pointer holds them, and with reduced motion they stay still. Three across; one under
another below 900px */
.dm-card.dm-wide .dm-stage-in:has(>.dm-axc){max-width:none}
/* installed, its card takes the room it is given, so the row can be three across */
[data-dm]:has(>.dm-stage-in>.dm-axc),[data-dm]>.dm-stage-in:has(>.dm-axc){width:100%;max-width:none}
.dm-axc{--dm-axc-hair:color-mix(in srgb,color-mix(in srgb,var(--dm-line),var(--dm-fg) 9%) 50%,transparent);width:100%;container:axc/inline-size}
.dm-axc-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--dm-s-3)}
.dm-axc-c.dm-panel{overflow:hidden;display:grid;grid-template-columns:minmax(0,1fr) 50%;min-height:156px;border-radius:var(--dm-r-card);box-shadow:inset 0 0 0 1px var(--dm-axc-hair)}
.dm-axc-tx{position:relative;z-index:1;display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:var(--dm-s-4)}
.dm-axc-tx b{font-size:14px;font-weight:500;color:var(--dm-fg);line-height:1.35}
.dm-axc-tx p{margin:0 0 var(--dm-s-4);font-size:13px;line-height:1.45;color:var(--dm-muted)}
.dm-axc-tx .dm-pill{margin-top:auto}
.dm-axc-v{position:relative;min-width:0;overflow:hidden}
.dm-axc-k{position:absolute;left:10px;right:var(--dm-s-4);top:0;display:flex;flex-direction:column;gap:15px;will-change:transform}
.dm-axc-k.dm-mv{transition:transform var(--dm-ax-mv,.7s) cubic-bezier(.65,0,.35,1)}
/* an item: a window when it's in focus, a grey slip when it's not (its content hidden). The windows end 16px in from the
card's right edge, on its content column (the template's 10px there is a near miss) */
.dm-axc-w{display:flex;flex-direction:column;gap:8px;padding:10px 12px;flex:none;border-radius:calc(var(--dm-r-card) - 10px);background:color-mix(in srgb,var(--dm-fg) 4%,var(--dm-surface));box-shadow:0 0 0 1px var(--dm-axc-hair);transition:background-color .45s var(--dm-ease),box-shadow .45s var(--dm-ease)}
.dm-axc-w>*{opacity:0;transition:opacity .35s var(--dm-ease)}
/* the window in focus takes Soft's card shadow */
.dm-axc-w.dm-on{background:var(--dm-surface);box-shadow:0 0 0 1px var(--dm-axc-hair),0 1px 1px rgba(0,0,0,.02),0 2px 4px -2px rgba(0,0,0,.025),0 6px 12px -6px rgba(0,0,0,.03),0 12px 24px -12px rgba(0,0,0,.035)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .dm-axc-w.dm-on{box-shadow:0 0 0 1px var(--dm-axc-hair),0 1px 2px rgba(0,0,0,.22),0 4px 10px -4px rgba(0,0,0,.24),0 12px 24px -12px rgba(0,0,0,.28)}}
:root[data-theme="dark"] .dm-axc-w.dm-on{box-shadow:0 0 0 1px var(--dm-axc-hair),0 1px 2px rgba(0,0,0,.22),0 4px 10px -4px rgba(0,0,0,.24),0 12px 24px -12px rgba(0,0,0,.28)}
.dm-axc-w.dm-on>*{opacity:1}
/* the grey slips above and below the window are 30% fainter than the window (owner, 27 Nov); the window in focus is whole */
.dm-axc-w:not(.dm-on){opacity:.7}
.dm-axc-w{transition-property:background-color,box-shadow,opacity}
.dm-axc-t{font-size:12px;font-weight:500;color:var(--dm-fg);line-height:15px}
.dm-axc-r{display:flex;align-items:center;gap:8px;min-width:0;min-height:18px}
.dm-axc-l{display:block;height:6px;flex:none;border-radius:3px;background:var(--dm-chip)}
/* a rep's commit: a ring until it's in, then a grey disc with a tick (grey, not green) */
.dm-axc-m{position:relative;margin-left:auto;width:14px;height:14px;flex:none;display:grid;place-items:center;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--dm-faint);color:var(--dm-surface);transition:background-color .25s var(--dm-ease),box-shadow .25s var(--dm-ease)}
.dm-axc-m svg{width:9px;height:9px;fill:none;stroke:currentColor;stroke-width:3.6;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:scale(.5);transition:opacity .25s var(--dm-ease),transform .3s var(--dm-ease)}
.dm-axc-m.dm-in{background:var(--dm-faint);box-shadow:none}
.dm-axc-m.dm-in svg{opacity:1;transform:none}
.dm-axc-i{width:22px;height:22px;flex:none;display:grid;place-items:center;border-radius:calc(6px * var(--dm-rk));background:var(--dm-a);color:var(--dm-ai)}
.dm-axc-n{font-size:12px;font-weight:500;color:var(--dm-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.dm-axc-d{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--dm-muted);white-space:nowrap}
.dm-axc-d s{text-decoration-color:currentColor}
/* a new date is grey until approved, then green; a draft is the accent tint until sent, then green */
.dm-axc .dm-tag.dm-axc-g{height:20px;font-size:11px;gap:4px;transition:background-color .25s var(--dm-ease),color .25s var(--dm-ease)}
.dm-axc .dm-tag.dm-axc-g.dm-ok{background:var(--dm-ok-bg);color:var(--dm-ok)}
.dm-axc .dm-tag.dm-axc-g.dm-dr{background:color-mix(in srgb,var(--dm-accent) 10%,transparent);color:var(--dm-accent-fg,var(--dm-accent))}
.dm-axc .dm-tag.dm-axc-g.dm-dr.dm-ok{background:var(--dm-ok-bg);color:var(--dm-ok)}
.dm-axc-g svg{width:10px;height:10px}
.dm-axc-g .dm-sw{display:inline-grid}
.dm-axc-g .dm-sw>*{grid-area:1/1;transition:opacity .25s var(--dm-ease),transform .3s var(--dm-ease)}
.dm-axc-g .dm-sw>.dm-b{opacity:0;transform:translateY(5px)}
.dm-axc-g.dm-ok .dm-sw>.dm-a{opacity:0;transform:translateY(-5px)}
.dm-axc-g.dm-ok .dm-sw>.dm-b{opacity:1;transform:none}
/* the pointer: glides to the thing, presses, glides off */
.dm-axc-cur{position:absolute;z-index:3;left:0;top:0;width:18px;height:18px;fill:var(--dm-accent-mark,var(--dm-accent));stroke:var(--dm-surface);stroke-width:1.5;stroke-linejoin:round;opacity:0;pointer-events:none;transition:transform .65s cubic-bezier(.22,1,.36,1),opacity .3s var(--dm-ease)}
.dm-axc-cur.dm-press{transition:transform .14s var(--dm-ease),opacity .3s var(--dm-ease)}
/* Blueprint: square, a hairline, no shadow; the draft tag in the lime tint */
:root:not([data-style="soft"],[data-style="studio"]) .dm-axc-c.dm-panel:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)),:root:not([data-style="soft"],[data-style="studio"]) :is(.dm-axc-w,.dm-axc-i):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){border-radius:0}
:root:not([data-style="soft"],[data-style="studio"]) .dm-axc-w.dm-on:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-fg) 18%,transparent)}
:root:not([data-style="soft"],[data-style="studio"]) .dm-axc .dm-tag.dm-axc-g.dm-dr:not(.dm-ok):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){background:color-mix(in srgb,var(--dm-accent) 40%,transparent)}
@media (prefers-color-scheme:dark){:root:not([data-style="soft"],[data-style="studio"]):not([data-theme="light"]) .dm-axc .dm-tag.dm-axc-g.dm-dr:not(.dm-ok):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){background:color-mix(in srgb,var(--dm-accent) 14%,transparent)}}
:root:not([data-style="soft"],[data-style="studio"])[data-theme="dark"] .dm-axc .dm-tag.dm-axc-g.dm-dr:not(.dm-ok):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){background:color-mix(in srgb,var(--dm-accent) 14%,transparent)}
@media (prefers-reduced-motion:reduce){.dm-axc-k.dm-mv,.dm-axc-w,.dm-axc-w>*,.dm-axc-cur,.dm-axc-m,.dm-axc-m svg{transition:none}}
/* one under another on a narrow stage, the picture beside the words */
@container axc (max-width:899px){.dm-axc-row{grid-template-columns:minmax(0,1fr)}.dm-axc-c.dm-panel{grid-template-columns:minmax(0,1fr) minmax(200px,40%)}}
@container axc (max-width:479px){.dm-axc-c.dm-panel{grid-template-columns:minmax(0,1fr) 46%;min-height:168px}.dm-axc-k{left:8px}}
ActionCards.astroAstro · 39 lines
---
// Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync.
// Action cards: What is waiting on you, each card with its button and a small picture of what it opens.
// The markup, CSS and script are designme.dev's own, run by the shared core in ../core, which mounts the component when it scrolls
// into view and plays its demo. To show your own data, change action-cards.js. The markup is kept exactly as it is (is:raw).
import type { HTMLAttributes } from 'astro/types';
import '../core/designme.css';
import './action-cards.css';
export interface Props extends HTMLAttributes<'div'> {
/** "soft" or "studio" draws it in that style. Leave it out for Blueprint, or for the style set on <html> (data-style="soft" or "studio") */
'data-style'?: 'soft' | 'studio';
}
const { class: className, ...rest } = Astro.props;
---
<div class:list={['card', 'wide', className]} data-c="action-cards" {...rest}>
<div class="stage-in"><Fragment is:raw>
<div class="axc">
<div class="axc-row">
<div class="panel axc-c" data-ax="commit">
<div class="axc-tx"><b>Submit the Q4 commit</b><p>5 reps to go, due Friday.</p><button class="pill line sm">Review commit</button></div>
<div class="axc-v" aria-hidden="true"><div class="axc-k"><div class="axc-w"><span class="axc-t">Key accounts</span><span class="axc-r"><span class="axc-l" style="width:60%"></span><span class="axc-m in"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span><span class="axc-r"><span class="axc-l" style="width:44%"></span><span class="axc-m" data-go><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span></div><div class="axc-w"><span class="axc-t">Growth</span><span class="axc-r"><span class="axc-l" style="width:52%"></span><span class="axc-m in"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span><span class="axc-r"><span class="axc-l" style="width:38%"></span><span class="axc-m" data-go><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span></div><div class="axc-w"><span class="axc-t">New business</span><span class="axc-r"><span class="axc-l" style="width:56%"></span><span class="axc-m in"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span><span class="axc-r"><span class="axc-l" style="width:46%"></span><span class="axc-m" data-go><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span></div></div><svg class="axc-cur" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5l12 6.2-5.3 1.5-2.4 5.1z"/></svg></div>
</div>
<div class="panel axc-c" data-ax="dates">
<div class="axc-tx"><b>Move 4 close dates</b><p>New dates are ready to be approved.</p><button class="pill line sm">Review dates</button></div>
<div class="axc-v" aria-hidden="true"><div class="axc-k"><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Renewal</span></span><span class="axc-d"><s class="num">Nov 25</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 9</span></span><span class="axc-l" style="width:72%"></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Renewal</span></span><span class="axc-d"><s class="num">Nov 23</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 11</span></span><span class="axc-l" style="width:72%"></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Studio seats</span></span><span class="axc-d"><s class="num">Nov 20</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 15</span></span><span class="axc-l" style="width:72%"></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Pilot</span></span><span class="axc-d"><s class="num">Nov 17</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 17</span></span><span class="axc-l" style="width:72%"></span></div></div><svg class="axc-cur" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5l12 6.2-5.3 1.5-2.4 5.1z"/></svg></div>
</div>
<div class="panel axc-c" data-ax="follow">
<div class="axc-tx"><b>Send 4 follow-ups</b><p>Drafts are ready to send. Review them.</p><button class="pill line sm">Review drafts</button></div>
<div class="axc-v" aria-hidden="true"><div class="axc-k"><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Saltmarsh Foods</span></span><span class="axc-l" style="width:88%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Moss & Ember</span></span><span class="axc-l" style="width:76%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Marrow & Finch</span></span><span class="axc-l" style="width:82%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Arbor & Vine</span></span><span class="axc-l" style="width:70%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div></div><svg class="axc-cur" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5l12 6.2-5.3 1.5-2.4 5.1z"/></svg></div>
</div>
</div>
</div>
</Fragment></div>
</div>
<script>
import './action-cards.js';
</script>
action-cards.htmlHTML · 21 lines
<div class="card wide" data-c="action-cards">
<div class="stage-in">
<div class="axc">
<div class="axc-row">
<div class="panel axc-c" data-ax="commit">
<div class="axc-tx"><b>Submit the Q4 commit</b><p>5 reps to go, due Friday.</p><button class="pill line sm">Review commit</button></div>
<div class="axc-v" aria-hidden="true"><div class="axc-k"><div class="axc-w"><span class="axc-t">Key accounts</span><span class="axc-r"><span class="axc-l" style="width:60%"></span><span class="axc-m in"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span><span class="axc-r"><span class="axc-l" style="width:44%"></span><span class="axc-m" data-go><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span></div><div class="axc-w"><span class="axc-t">Growth</span><span class="axc-r"><span class="axc-l" style="width:52%"></span><span class="axc-m in"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span><span class="axc-r"><span class="axc-l" style="width:38%"></span><span class="axc-m" data-go><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span></div><div class="axc-w"><span class="axc-t">New business</span><span class="axc-r"><span class="axc-l" style="width:56%"></span><span class="axc-m in"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span><span class="axc-r"><span class="axc-l" style="width:46%"></span><span class="axc-m" data-go><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></span></div></div><svg class="axc-cur" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5l12 6.2-5.3 1.5-2.4 5.1z"/></svg></div>
</div>
<div class="panel axc-c" data-ax="dates">
<div class="axc-tx"><b>Move 4 close dates</b><p>New dates are ready to be approved.</p><button class="pill line sm">Review dates</button></div>
<div class="axc-v" aria-hidden="true"><div class="axc-k"><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Renewal</span></span><span class="axc-d"><s class="num">Nov 25</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 9</span></span><span class="axc-l" style="width:72%"></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Renewal</span></span><span class="axc-d"><s class="num">Nov 23</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 11</span></span><span class="axc-l" style="width:72%"></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Studio seats</span></span><span class="axc-d"><s class="num">Nov 20</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 15</span></span><span class="axc-l" style="width:72%"></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-r);--dm-ai:var(--dm-av-r-ink)"><svg class="i xs"><use href="#i-cal"/></svg></span><span class="axc-n">Pilot</span></span><span class="axc-d"><s class="num">Nov 17</s><svg class="i xs"><use href="#i-right"/></svg><span class="tag axc-g num" data-go>Dec 17</span></span><span class="axc-l" style="width:72%"></span></div></div><svg class="axc-cur" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5l12 6.2-5.3 1.5-2.4 5.1z"/></svg></div>
</div>
<div class="panel axc-c" data-ax="follow">
<div class="axc-tx"><b>Send 4 follow-ups</b><p>Drafts are ready to send. Review them.</p><button class="pill line sm">Review drafts</button></div>
<div class="axc-v" aria-hidden="true"><div class="axc-k"><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Saltmarsh Foods</span></span><span class="axc-l" style="width:88%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Moss & Ember</span></span><span class="axc-l" style="width:76%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Marrow & Finch</span></span><span class="axc-l" style="width:82%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div><div class="axc-w"><span class="axc-r"><span class="axc-i" style="--dm-a:var(--dm-av-b);--dm-ai:var(--dm-av-b-ink)"><svg class="i xs"><use href="#i-mail"/></svg></span><span class="axc-n">Arbor & Vine</span></span><span class="axc-l" style="width:70%"></span><span class="axc-r"><span class="tag axc-g dr" data-go><svg class="i xs"><use href="#i-spark"/></svg><span class="sw"><span class="a">Drafted</span><span class="b">Sent</span></span></span></span></div></div><svg class="axc-cur" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 2.5l12 6.2-5.3 1.5-2.4 5.1z"/></svg></div>
</div>
</div>
</div>
</div>
</div>
action-cards.cssHTML · 69 lines
/* ---------- Action cards ---------- */
/* the Sales CRM forecast's next steps (owner, 27 Nov; designed 16 Nov): each card says what is waiting, with a button that opens
it, beside a small picture of what that button leads to. The picture is a short list: the item in focus is a window, its
neighbours grey slips above and below. In a loop a pointer glides to the item, presses, the item changes (a commit ticks
in, a new date is approved, a draft is sent), then the list scrolls up to the next. The three run at different speeds so
they never move together, a resting pointer holds them, and with reduced motion they stay still. Three across; one under
another below 900px */
.card.wide .stage-in:has(>.axc){max-width:none}
/* installed, its card takes the room it is given, so the row can be three across */
[data-c]:has(>.stage-in>.axc),[data-c]>.stage-in:has(>.axc){width:100%;max-width:none}
.axc{--dm-axc-hair:color-mix(in srgb,color-mix(in srgb,var(--dm-line),var(--dm-fg) 9%) 50%,transparent);width:100%;container:axc/inline-size}
.axc-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--dm-s-3)}
.axc-c.panel{overflow:hidden;display:grid;grid-template-columns:minmax(0,1fr) 50%;min-height:156px;border-radius:var(--dm-r-card);box-shadow:inset 0 0 0 1px var(--dm-axc-hair)}
.axc-tx{position:relative;z-index:1;display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:var(--dm-s-4)}
.axc-tx b{font-size:14px;font-weight:500;color:var(--dm-fg);line-height:1.35}
.axc-tx p{margin:0 0 var(--dm-s-4);font-size:13px;line-height:1.45;color:var(--dm-muted)}
.axc-tx .pill{margin-top:auto}
.axc-v{position:relative;min-width:0;overflow:hidden}
.axc-k{position:absolute;left:10px;right:var(--dm-s-4);top:0;display:flex;flex-direction:column;gap:15px;will-change:transform}
.axc-k.mv{transition:transform var(--dm-ax-mv,.7s) cubic-bezier(.65,0,.35,1)}
/* an item: a window when it's in focus, a grey slip when it's not (its content hidden). The windows end 16px in from the
card's right edge, on its content column (the template's 10px there is a near miss) */
.axc-w{display:flex;flex-direction:column;gap:8px;padding:10px 12px;flex:none;border-radius:calc(var(--dm-r-card) - 10px);background:color-mix(in srgb,var(--dm-fg) 4%,var(--dm-surface));box-shadow:0 0 0 1px var(--dm-axc-hair);transition:background-color .45s var(--dm-ease),box-shadow .45s var(--dm-ease)}
.axc-w>*{opacity:0;transition:opacity .35s var(--dm-ease)}
/* the window in focus takes Soft's card shadow */
.axc-w.on{background:var(--dm-surface);box-shadow:0 0 0 1px var(--dm-axc-hair),0 1px 1px rgba(0,0,0,.02),0 2px 4px -2px rgba(0,0,0,.025),0 6px 12px -6px rgba(0,0,0,.03),0 12px 24px -12px rgba(0,0,0,.035)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .axc-w.on{box-shadow:0 0 0 1px var(--dm-axc-hair),0 1px 2px rgba(0,0,0,.22),0 4px 10px -4px rgba(0,0,0,.24),0 12px 24px -12px rgba(0,0,0,.28)}}
:root[data-theme="dark"] .axc-w.on{box-shadow:0 0 0 1px var(--dm-axc-hair),0 1px 2px rgba(0,0,0,.22),0 4px 10px -4px rgba(0,0,0,.24),0 12px 24px -12px rgba(0,0,0,.28)}
.axc-w.on>*{opacity:1}
/* the grey slips above and below the window are 30% fainter than the window (owner, 27 Nov); the window in focus is whole */
.axc-w:not(.on){opacity:.7}
.axc-w{transition-property:background-color,box-shadow,opacity}
.axc-t{font-size:12px;font-weight:500;color:var(--dm-fg);line-height:15px}
.axc-r{display:flex;align-items:center;gap:8px;min-width:0;min-height:18px}
.axc-l{display:block;height:6px;flex:none;border-radius:3px;background:var(--dm-chip)}
/* a rep's commit: a ring until it's in, then a grey disc with a tick (grey, not green) */
.axc-m{position:relative;margin-left:auto;width:14px;height:14px;flex:none;display:grid;place-items:center;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--dm-faint);color:var(--dm-surface);transition:background-color .25s var(--dm-ease),box-shadow .25s var(--dm-ease)}
.axc-m svg{width:9px;height:9px;fill:none;stroke:currentColor;stroke-width:3.6;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:scale(.5);transition:opacity .25s var(--dm-ease),transform .3s var(--dm-ease)}
.axc-m.in{background:var(--dm-faint);box-shadow:none}
.axc-m.in svg{opacity:1;transform:none}
.axc-i{width:22px;height:22px;flex:none;display:grid;place-items:center;border-radius:calc(6px * var(--dm-rk));background:var(--dm-a);color:var(--dm-ai)}
.axc-n{font-size:12px;font-weight:500;color:var(--dm-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.axc-d{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--dm-muted);white-space:nowrap}
.axc-d s{text-decoration-color:currentColor}
/* a new date is grey until approved, then green; a draft is the accent tint until sent, then green */
.axc .tag.axc-g{height:20px;font-size:11px;gap:4px;transition:background-color .25s var(--dm-ease),color .25s var(--dm-ease)}
.axc .tag.axc-g.ok{background:var(--dm-ok-bg);color:var(--dm-ok)}
.axc .tag.axc-g.dr{background:color-mix(in srgb,var(--dm-accent) 10%,transparent);color:var(--dm-accent-fg,var(--dm-accent))}
.axc .tag.axc-g.dr.ok{background:var(--dm-ok-bg);color:var(--dm-ok)}
.axc-g svg{width:10px;height:10px}
.axc-g .sw{display:inline-grid}
.axc-g .sw>*{grid-area:1/1;transition:opacity .25s var(--dm-ease),transform .3s var(--dm-ease)}
.axc-g .sw>.b{opacity:0;transform:translateY(5px)}
.axc-g.ok .sw>.a{opacity:0;transform:translateY(-5px)}
.axc-g.ok .sw>.b{opacity:1;transform:none}
/* the pointer: glides to the thing, presses, glides off */
.axc-cur{position:absolute;z-index:3;left:0;top:0;width:18px;height:18px;fill:var(--dm-accent-mark,var(--dm-accent));stroke:var(--dm-surface);stroke-width:1.5;stroke-linejoin:round;opacity:0;pointer-events:none;transition:transform .65s cubic-bezier(.22,1,.36,1),opacity .3s var(--dm-ease)}
.axc-cur.press{transition:transform .14s var(--dm-ease),opacity .3s var(--dm-ease)}
/* Blueprint: square, a hairline, no shadow; the draft tag in the lime tint */
:root:not([data-style="soft"],[data-style="studio"]) .axc-c.panel:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)),:root:not([data-style="soft"],[data-style="studio"]) :is(.axc-w,.axc-i):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){border-radius:0}
:root:not([data-style="soft"],[data-style="studio"]) .axc-w.on:not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-fg) 18%,transparent)}
:root:not([data-style="soft"],[data-style="studio"]) .axc .tag.axc-g.dr:not(.ok):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){background:color-mix(in srgb,var(--dm-accent) 40%,transparent)}
@media (prefers-color-scheme:dark){:root:not([data-style="soft"],[data-style="studio"]):not([data-theme="light"]) .axc .tag.axc-g.dr:not(.ok):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){background:color-mix(in srgb,var(--dm-accent) 14%,transparent)}}
:root:not([data-style="soft"],[data-style="studio"])[data-theme="dark"] .axc .tag.axc-g.dr:not(.ok):not(:where([data-style="soft"],[data-style="soft"] *,[data-style="studio"],[data-style="studio"] *)){background:color-mix(in srgb,var(--dm-accent) 14%,transparent)}
@media (prefers-reduced-motion:reduce){.axc-k.mv,.axc-w,.axc-w>*,.axc-cur,.axc-m,.axc-m svg{transition:none}}
/* one under another on a narrow stage, the picture beside the words */
@container axc (max-width:899px){.axc-row{grid-template-columns:minmax(0,1fr)}.axc-c.panel{grid-template-columns:minmax(0,1fr) minmax(200px,40%)}}
@container axc (max-width:479px){.axc-c.panel{grid-template-columns:minmax(0,1fr) 46%;min-height:168px}.axc-k{left:8px}}
action-cards.jsHTML · 42 lines
DM.def('action-cards', (r, c) => {
r.innerHTML = r.innerHTML.replace(/\{([\w-]+)\}/g, (m, k) => I(k, 'xs'));
// each picture's pace: how long an item stays, how long the list takes to move on, and how late it starts
const PACE = { commit:{ step:3600, mv:700, at:0 }, dates:{ step:3000, mv:600, at:700 }, follow:{ step:4200, mv:800, at:1400 } };
const loop = async card => {
const P = PACE[card.dataset.ax] || PACE.commit, vis = $('.axc-v', card), k = $('.axc-k', card), cur = $('.axc-cur', vis);
// the track: the last item first (the slip above), the list, then its first two again so the loop can wrap unseen
const own = $$('.axc-w', k), n = own.length;
k.prepend(own[n - 1].cloneNode(true)); k.append(own[0].cloneNode(true), own[1 % n].cloneNode(true));
const W = $$('.axc-w', k); let i = 1;
k.style.setProperty('--dm-ax-mv', P.mv + 'ms');
const place = (idx, anim) => { k.classList.toggle('mv', anim); const it = W[idx]; k.style.transform = `translateY(${Math.round((vis.clientHeight - it.offsetHeight) / 2 - it.offsetTop)}px)`;
W.forEach((x, m) => x.classList.toggle('on', m === idx)); };
requestAnimationFrame(() => place(i, false));
// and again, at once, when its room changes (the row stacking on a narrow stage)
if (window.ResizeObserver){ const ro = new ResizeObserver(() => place(i, false)); ro.observe(vis); c.offs.push(() => ro.disconnect()); }
if (REDUCE) return;
const at = el => { const v = vis.getBoundingClientRect(), b = el.getBoundingClientRect(); return [b.left - v.left + b.width * .55, b.top - v.top + b.height * .5]; };
await c.wait(P.at + 900);
for (;;){
const go = $('[data-go]', W[i]);
if (go){
const [x, y] = at(go);
cur.classList.remove('press'); cur.style.transition = 'none'; cur.style.transform = `translate(${x + 34}px,${y + 26}px)`; void cur.offsetWidth; cur.style.transition = '';
cur.style.opacity = 1; cur.style.transform = `translate(${x}px,${y}px)`;
await c.wait(700);
cur.classList.add('press'); cur.style.transform = `translate(${x}px,${y}px) scale(.8)`;
await c.wait(140);
cur.style.transform = `translate(${x}px,${y}px)`; go.classList.add(go.classList.contains('axc-m') ? 'in' : 'ok');
await c.wait(520);
cur.classList.remove('press'); cur.style.opacity = 0; cur.style.transform = `translate(${x + 18}px,${y + 14}px)`;
}
await c.wait(Math.max(300, P.step - 1700));
// scroll up to the next item; past the end, jump back unseen to the same item at the start, all fresh again
i++; place(i, true);
await c.wait(P.mv + 60);
if (i === n + 1){ i = 1; W.forEach(x => $$('[data-go]', x).forEach(g => g.classList.remove('in', 'ok'))); place(i, false); }
}
};
c.run(() => Promise.all($$('.axc-c', r).map(loop)));
});
Questions
What people ask about it.
- Can I have two cards or four?
- Yes. In React pass as many
cardsas you need; the row keeps three across and the rest wrap. In HTML add or remove a.axc-ccard. - Can a card have no picture?
- The picture is what tells these cards apart from a plain notice. For a line of text with a button, Banner fits better.
- Why does the picture stop while I hover?
- So it never moves while someone reads it or reaches for the button. It carries on as soon as the pointer leaves.
More in Review and approve
Moments where a person checks, steers or signs off on the agent's work.