opinion
VersionHistory
A drawer of saved snapshots with a confirm-before-restore button on each row.
Brief historyOpen the drawer, restore asks first
In context
Document headerHistory sits next to the doc it belongs to
On track
MCHarbour launch briefEdited by Maya, 24 Oct 09:12
Launch is 24 Oct at 09:00. The crew briefing goes out two days before, and the livery photos are filed under Brand.
Props
| Prop | Type | Required | Default |
|---|---|---|---|
open | boolean | undefined | No | — |
defaultOpen | boolean | undefined | No | — |
onOpenChange | ((open: boolean) => void) | undefined | No | — |
trigger | ReactNode | No | — |
title | ReactNode | No | Version history |
side | DrawerSide | undefined | No | — |
size | number | undefined | No | — |
className | string | undefined | No | — |
versions | VersionSnapshot[] | Yes | — |
currentVersionId | string | undefined | No | — |
onRestore | (version: VersionSnapshot) => void | Yes | — |
restoreConfirmMessage | ((version: VersionSnapshot) => string) | undefined | No | (version: VersionSnapshot) => `Restore "${version.label}"? This replaces the current content.` |
bionic | boolean | undefined | No | — |
bionicOptions | BionicOptions | undefined | No | — |
Restore
Built from the drawer chrome, a Popconfirm (it never restores on the first click) and a Tag for the current version.
data-rebar-* attributes
data-rebar-component="version-history"; rows carry data-rebar-part="row" | "label" | "timestamp" | "preview" | "restore-button".
Migrating to Ant Design
Not codemod-covered. Compose AntD's Drawer, List and Popconfirm; the shape maps across almost verbatim.