Uh oh!
There was an error while loading. Please reload this page.
Add Timeline.Actions sub-component - #7886
Conversation
Adds a Timeline.Actions slot for rendering buttons, links, SHAs, and status labels on the right edge of a Timeline.Item. Renders as a horizontal flex row with a default gap and a min-height matching the badge so contents vertically center against it in both default and condensed item geometries. Closesgithub/primer#6678
🦋 Changeset detectedLatest commit: 2651fe8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
- Constrain the Timeline to 1012px (GitHub's product max-width) so Actions content sits a realistic distance from the event text - Add force-push event variant with branch chip + Compare button - Reorder verified commit row to match GitHub: Verified label → check → SHA - Add unverified commit row variant (Unverified label + X icon) - Restructure cross-reference: title moves into Body, Actions reduces to lock + Open state pill
…styling - Restore a two-button example (View details + Revert) on the merge-queue item, matching GitHub's actual merge-queue presentation. - Verified label now uses the default muted Label border with green text only, matching the real product (variant=success was too loud). - Commit SHA links are monospace and underlined. - Check icon renders in success green, X icon in danger red.
- Use CrossReferenceIcon instead of GitPullRequestIcon. - Wrap referenced item title + number + tasklist in a bordered card. - Add 'just now' timestamp to the mention line. - Use StateLabel (status=pullOpened, size=small) instead of plain Label for the Open pill. - Add TasklistIcon + '17 tasks' sub-line inside the card.
…, add inline avatar - Remove bordered card container — the Figma shows plain indented content, not a card. - Issue title uses standard accent-colored link (not bold muted), matching GitHub's actual rendering. - Add 16px inline Avatar next to username, which is distinct from the 40px left-gutter Timeline.Avatar.
Uh oh!
There was an error while loading. Please reload this page.
Closes github/primer#6678
Timelineevent rows frequently render content floated to the right of the event summary: revert buttons after a merge, view-details toggles on Merge Queue, commit SHA links with verification badges and CI state icons, cross-reference state labels with optional lock icons for private references, and so on. Today there is no built-in slot for any of that — anything floated right has to be crammed insideTimeline.Bodywith story-local CSS, which is exactly the kind of one-off hack that compounds into tech debt across consumers.This PR adds
Timeline.Actions, a sibling sub-component ofTimeline.Bodythat takes any React children and lays them out as a horizontal flex row on the right edge of the surroundingTimeline.Item. It works for every right-side pattern we've inventoried so far: a single button, two buttons, a commit row with multiple inline elements (icon + SHA link + verified label), and a cross-reference row (lock icon + reference link + state label).This is the second of two Phase 1 follow-ups (paired with
Timeline.Avatarin #7885). Both ship as standalone APIs; migrating the in-flight Custom Event playground (#7836) to use them is a follow-up once that PR lands onmain.Changelog
New
Timeline.Actionssub-component: a children-based slot that lays out arbitrary children (buttons, links, badges, icons, plain text) as a horizontal flex row pushed to the right edge of aTimeline.Item.TimelineActionsPropstype exported from@primer/react.Timeline/Features → WithActions, demonstrating common right-side action patterns across five realistic timeline items.Changed
Removed
Design notes
Timeline.Avatarprecedent and the issue's preferred option. Consumers compose freely (<Button>,<ButtonGroup>,<Link>,<Label>,<Octicon>, plain text), andTimeline.Actionsjust handles the row layout.Timeline.Avatar(which is absolutely positioned in the gutter outside the item),Timeline.Actionsis a flex item inside the item, pushed right withmargin-left: auto. This keepsTimeline.Bodyshrinkable: when content is long,Bodywraps first (flex-shrink: 0on Actions) and the layout degrades gracefully.min-height: var(--base-size-32)matches the badge wrapper height (which is 32px in both default and condensed item modes thanks to the existing condensed margin rules). Combined withalign-items: centerandalign-self: flex-start, contents vertically center against the badge in both geometries — no condensed override needed.gap: var(--base-size-8)is set on the Actions row so multi-child layouts (button + button, icon + SHA + label, etc.) get GitHub's standard 8px spacing out of the box without consumer styling. Single-child layouts are unaffected.Known limitation / future work
BodyandActionshave substantial content and the Timeline container is narrow,Bodytext wraps aggressively whileActionskeeps the right edge. Resolving this is intentionally out of scope here and tracked separately in github/primer#6693 (Phase 4) so it can be resolved with design input.gapprop or CSS custom property could be added if non-default spacing becomes a recurring need.Rollout strategy
Testing & Reviewing
Open
Timeline/Features → WithActionsin Storybook. The story renders five timeline items inside a 1012px max-width wrapper (matching GitHub's product width). All links usepreventDefaultso clicking them won't navigate.Verify each item:
main…" with a checks-passed subline. Two buttons on the right: View details + Revert. UsesBranchNamefor the branch chip and a 12px monospace semibold SHA.mainbranch from … to …" with a timestamp. Single Compare button on the right. UsesRepoPushIconfor the badge.StateLabel("Open", medium, pullOpened) are vertically centered in the card row — these are intentionally in the body content, not inTimeline.Actions, because that's how GitHub renders cross-references.Bodywraps beforeActionsis squeezed.Note for reviewers
This PR is built on
main. Because it touches several of the same files as the in-flightTimeline.AvatarPR (#7885), the second of the two to land will need a rebase — straightforward 3-way merges on theObject.assign(Timeline, …)block, the type export list, thesubcomponentsblock in the stories metas, the__tests__/Timeline.test.tsxdescribe blocks, and theTimeline.docs.jsonsubcomponent list. No semantic conflict.Merge checklist