Timeline: add Dependabot event stories (Phase 2)#8071
Conversation
|
There was a problem hiding this comment.
Pull request overview
Adds a new Storybook “Features” story set under Components/Timeline/Events/Dependabot to document/recreate GitHub’s Dependabot alert timeline event rows using Primer React Timeline composition (including Timeline.Actions), plus supporting CSS modules for pixel-faithful styling.
Changes:
- Added
Timeline.dependabot.features.stories.tsxwith 5 event-group exports (Opened, Fixed, Dismissed, Reopened, Dismissal Request) and shared helper subcomponents (actor, timestamp, push-pill, note row). - Added
Timeline.dependabot.features.stories.module.cssto style inline avatars, bold links, push-pill appearance, note rows, and badge icon coloring.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/Timeline/Timeline.dependabot.features.stories.tsx | New Dependabot timeline event stories, including helper components and Timeline.Actions usage for the review-request control. |
| packages/react/src/Timeline/Timeline.dependabot.features.stories.module.css | Story-only CSS modules to match GitHub’s Dependabot timeline visuals (inline avatars, push-pill, badge icon coloring, timestamps). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 5
- Review effort level: Low
ab9be6c to
24a5b97
Compare
02c0dad to
a3b9975
Compare
24a5b97 to
97c0b18
Compare
Storybook-only Dependabot alert timeline event stories under Components/Timeline/Events/Dependabot, mirroring the Issues stories pattern. Scoped to the eventOpened group (Opened / OpenedFromPR / OpenedFromPush) as a reviewable proof-of-pattern. Translated from the live server-rendered ERB (DependabotAlerts::TimelineItems::OpenedComponent). Not wired into components-json / primer.style docs by design. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Completes the Dependabot alert timeline event stories (Phase 2): adds eventFixed, eventDismissed, eventReopened, and eventDismissalRequest alongside the existing eventOpened group. Adds circle UserActor and no-avatar PlainActor helpers and a NoteComment sub-content helper, all translated from the live server-rendered ERB (github/github app/components/dependabot_alerts/timeline_items/). Corrects the push-pill to the subtle light-blue GitHub SHA pill (bgColor-accent-muted + fgColor-accent), matching Primer view_components' bg: :accent mapping rather than the solid emphasis blue. Storybook-only by design; not wired into components-json / primer.style docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The dismissal_*_component.rb files use ViewComponent::InlineTemplate, so their inline erb_template is the active render and the .html.erb sidecars are dead code. Rebuild Requested/Approved/Denied to the avatar-based inline version: circle user actor (UserActor), and status-driven badges via named variants — Requested attention/comment, Approved success/check, Denied danger/x. Cancelled keeps the plain default (subtle) x badge per its inline template. Optional review/resolution notes use the shared NoteComment sub-row. Removes the now-unused PlainActor helper and its CSS, plus the unused Muted, ResolutionLine, and ReviewCommentBox/Label styles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The dismissal inline ERB uses with_badge(color: :X, icon: Y) with no bg:, which tints the icon on the default badge background rather than producing a solid emphasis badge. Replace the named attention/success/danger Timeline.Badge variants with a bare Timeline.Badge plus a colored Octicon (icon color via a .BadgeIcon* class), mirroring the muted Dismissed treatment. Cancelled's :subtle maps to --fgColor-muted (no --fgColor-subtle token exists). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Dismissal Requested event's live inline template renders a float-right DismissalReviewDialogComponent when show_dismissal_actions is true — its visible control is a single small primary "Review request" button that opens the approve/deny review dialog. Surface it in the Timeline.Actions right-controls slot (#6678) on the Requested variant only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The bare alert-rule-name links in the auto-dismissed and auto-reopened note rows had no non-color distinction, failing axe link-in-text-block (WCAG 1.4.1) in high-contrast themes. Add the inline prop (Primer underlines inline links), matching the live ERB (the rule name is a plain, non-bold Primer::Beta::Link) and the convention used by the Issues stories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Match the live DismissalReviewDialogComponent show-button (scheme: :primary, size: :small) and the inline comment describing it. Addresses Copilot review. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… guard (Timeline Dependabot stories) - Remove aria-label from every Timeline.Badge Octicon: the label restated the adjacent Body sentence, double-announcing each event. Bare octicons default to aria-hidden, matching live GitHub. - Add a shared Examples wrapper carrying data-a11y-link-underlines="true" so Primer underlines <Link inline> content links (reproduces GitHub's default-on link-underline preference; non-color distinction, WCAG 1.4.1). Actor-name links use className without inline, so they stay semibold with no underline. - Harden the wrapper click guard to e.target instanceof Element before closest() so clicking an SVG/Octicon no longer throws. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Swap the Dependabot stories' local scaffolding for the shared ./internal/timelineStoryHelpers module: VariantSection (captioned section), Examples (width + a11y-underline hint + click guard), BoldLink, InlineAvatar, and MutedTime. Rewrite DependabotActor/UserActor to compose the shared BoldLink + InlineAvatar (square passthrough for the bot). Delete the now-duplicated local Examples/Time helpers and the .Variant/.VariantLabel/.RealisticTimeline/ .LinkWithBoldStyle/.InlineAvatar/.Timestamp classes. Dependabot-specific styling (push-pill, bot Label, note sub-row, badge-icon colors) stays local. Pure refactor — no visual or functional change (axe AAT 45/45 unchanged). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
97c0b18 to
054b732
Compare
Summary
Adds Storybook Features stories that recreate GitHub's live Dependabot alert timeline events using the Primer
Timelinecomponent and its compositional slots. This is the Dependabot surface of Phase 2 of the Timeline events effort (github/primer#6663). The Issues surface already landed in #8070; the PR and other surfaces will follow separately.All examples live in a single new file,
Timeline.dependabot.features.stories.tsx(+ a.module.css), exported under the titleComponents/Timeline/Events/Dependabot— one story export per event group.The 5 event groups (23 variants total)
EventOpenedshieldon solidsuccessEventFixedshield-checkon soliddoneEventDismissedshield-slash(muted icon)EventReopenedsyncon solidsuccessEventDismissalRequestSource of truth
These stories were recreated from the live, server-rendered ERB ViewComponents in
app/components/dependabot_alerts/timeline_items/ingithub/github. Each component's render markup and the Primer component arguments it passes were read directly and translated faithfully into Primer React; the source file is cited inline next to each event.Notably, Dependabot's alert timeline has no React implementation yet — it is 100% ERB.
github/github-uiships only Catalyst custom-element controllers (dependabot-alert-*-element.ts) for table-row / load-all / dismissal interactions, not the timeline event rows. So beyond documenting the design system, these stories double as a useful reference for that team's eventual ERB→React migration.We verified the live render path per component rather than trusting the Figma audit blindly. The most important catch: the dismissal request/review events use a newer inline
erb_template(include ViewComponent::InlineTemplate), which is the active render — the older sibling*.html.erbsidecars are dormant dead code. The Figma audit reflected the dormant sidecar (no-avatar,person/check-circlebadges); the live inline template renders a circle user avatar with status-driven icons. Live won.We were also careful about the Primer badge mechanic: events whose ERB sets
bg: :*_emphasis(Opened/Fixed/Reopened) correctly use a solidTimeline.Badge variant, while events whose ERB sets onlycolor: :*with nobg:(Dismissed, Dismissal Request/Review/Cancelled) render as a bare default badge with a colored icon — not a solid-color badge.Slots used (Phase 1 slots)
Timeline.Bodyfor badge-row events — a square avatar + bold link +(bot)Labelfor Dependabot-authored events (ActorComponent:dependabotmode), and a circle 20px user avatar + bold link for user-authored events.Timeline.Actions(right-controls slot, added in Add Timeline.Actions sub-component #7886) for the Dismissal Requested "Review request" button — the live inline template renders afloat-rightDismissalReviewDialogComponent, whose visible control is a single small primary button that opens the approve/deny dialog.(bot)tag (Label variant="secondary", mirroring ERBbot_identifier_tag), and the inline push-pill SHA (PushLinkComponent→ a<code>-wrappedLinkstyled as the subtle light-blue GitHub SHA pill). Push-pills are part of the sentence body text in the livePushLinkComponent, so they correctly stay inline inTimeline.Body, not inTimeline.Actions.Scope & conventions
FeatureFlagsdecorator enablingprimer_react_timeline_list_semantics(the future-state<ol>/<li>DOM; refs Timeline: Use list semantics for screen reader navigation #7910).Timeline.docs.jsonorbuild.ts) — individual timeline events are not consumer-facing components.data-*filtering taxonomy (github/primer#6663) is intentionally deferred; the hook location is documented in the file header.Changelog
New
Timeline.dependabot.features.stories.tsxandTimeline.dependabot.features.stories.module.css— Storybook Features stories recreating the Dependabot alert timeline events (5 groups, 23 variants).Changed
Removed
Rollout strategy
Stories-only change — no consumer-facing package code is added or modified, so no changeset is needed (the
skip changesetlabel is applied).Testing & Reviewing
@primer/doc-genbaseline error inscript/components-json/build.tsis unchanged).Merge checklist