Files
TREK/client/src/components/Assistant/cards/parts/CardFrame.tsx
T
Maurice a3fc696510 feat(assistant): the chat's cards wear the trip dialogs' look
The cards were rows of badges in badges with no head of their own; they now
follow the frame #2541 gave the trip's dialogs and booking cards.
- Every answer card and the change card open on a tinted head band: a raised
  tile with the icon (a route its sketch), the kind as an eyebrow, the title,
  one quiet line and the count; the change card turns green once decided.
- Figures are framed fields under their labels (a route's distance, climb,
  descent, time), the parts of a card sit under eyebrows (height profile,
  stops), and the ways onward sit in a foot bar across the card.
- A route's stops are a timeline down a line, each walk on the line between
  two stops; the ways of a route are calm choices with their figures in one
  line and how they differ from the chosen one in another.
- Packing, to-dos, the journal, Vacay and the Atlas get the band; quantities
  and weights are quiet figures, an expense's place and split share one line.
2026-10-23 15:33:08 +02:00

43 lines
1.2 KiB
TypeScript

import type { ReactNode } from 'react';
/**
* The frame every answer card sits in, the same as the change card's: a
* rounded card on the chat whose head band (CardHeader) runs to its edges. A waiting change shows its frame dashed, a
* removed one faded, a settled one (discarded, expired, undone) fainter
* still. The chat card (a message in the trip chat) sits on the quieter
* secondary surface.
*/
type FrameState = 'answer' | 'pending' | 'removed' | 'settled';
const STATE: Record<FrameState, string> = {
answer: 'border-edge-faint',
pending: 'border-dashed border-edge',
removed: 'border-edge-faint opacity-60',
settled: 'border-edge-faint opacity-50',
};
export default function CardFrame({
label,
state = 'answer',
surface = 'card',
children,
}: {
/** What the card is, for a screen reader. */
label: string;
state?: FrameState;
surface?: 'card' | 'secondary';
children: ReactNode;
}) {
return (
<section
aria-label={label}
className={`trek-assistant-enter overflow-hidden rounded-[16px] border px-3.5 pb-3 pt-3 shadow-card ${STATE[state]} ${
surface === 'secondary' ? 'bg-surface-secondary' : 'bg-surface-card'
}`}
>
{children}
</section>
);
}