Timeline: add comment event stories (Phase 2)#8072
Conversation
Storybook-only example recreating GitHub's issue-timeline comment card from Primer React primitives (Avatar, Link, Label, RelativeTime, IconButton) under Components/Timeline/Events/Comments. Not wired into Timeline.docs.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the comment stories under Components/Timeline/Events/Issues, extract a local CommentCard helper, and add bot/Copilot/Dependabot/via-app variants recreated from the live github-ui ActivityHeader. Storybook-only; isReply prop wired for deferred threaded replies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Capture the source-of-truth rationale (github.com renders bot/app avatars
square by account type; ActivityHeader's square={isCopilot} doesn't force bots
circular) as inline comments on CommentBot + CommentDependabot so reviewers
don't revert to circle.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
… stories - Seat the 40px gutter avatar ON the Timeline rail (rail passes behind the avatar, not behind the card) and push the card right via margin-left so the speech-bubble caret bridges avatar to card; drop the double left padding. - Add an octicon-avatar mode to CommentCard (avatarIcon prop) and render the Copilot gutter avatar as a muted CopilotIcon in a 40px circle. - Consolidate the five separate exports into a single EventComment story with the variants stacked in captioned sections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per the Figma spec, render the Dependabot comment gutter avatar as a white DependabotIcon on an accent-blue rounded square via the octicon-avatar mode (new avatarIconShape/avatarIconTone props), replacing the off-brand photo URL. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Storybook-only “Features” story group that recreates GitHub Issues timeline comment cards using Timeline.Item + Timeline.Avatar plus a co-located CSS module for the card shell (header, caret, reactions).
Changes:
- Added
Timeline.comments.features.stories.tsxwith a localCommentCardhelper and a singleEventCommentexport showing 5 actor variants (standard user, bot, Copilot, Dependabot, via-app). - Added
Timeline.comments.features.stories.module.cssto style the comment-card layout (card chrome, caret, avatar positioning, reactions row). - Wrapped stories in the
primer_react_timeline_list_semanticsfeature-flag decorator for future<ol>/<li>semantics.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/Timeline/Timeline.comments.features.stories.tsx | Adds the Storybook “Issues” comment-card event group and supporting local composition helpers. |
| packages/react/src/Timeline/Timeline.comments.features.stories.module.css | Provides scoped CSS to visually compose a GitHub-like comment card (caret, header bar, reactions, octicon avatars). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Low
Match Figma: avatar left edge ~72px left of the rail, card overlaps the rail by 16px (so the rail runs behind the card's left edge), avatar→card ~56px, with the caret bridging the gap. Remove the divider above the reactions row to match the live comment card. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid a runtime throw when the click target is a non-Element (e.g. an SVG octicon) by checking e.target instanceof Element before calling closest. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Part of github/primer#6663 (Phase 2).
Adds Storybook Features stories that recreate GitHub's timeline comment cards using Primer React. These are the comment events of the Issues surface. They complement the badge-row Issue events (#8070) and the Dependabot alert events (#8071). The stories here are the Issue-sourced (React) comment versions — the PR-sourced (ERB) comment version will come later with the future PR surface.
What's included
A new
packages/react/src/Timeline/Timeline.comments.features.stories.tsx(+ co-located CSS module) under the titleComponents/Timeline/Events/Issues, so the comment stories nest beside the badge-row Issue stories. The five variants are all built on a small, file-localCommentCardhelper (not exported), so each story stays a short<CommentCard … />:Authorbadge, reactions row)botlabel)AIlabel, name renders as "Copilot")botlabel)Deferred (not in this PR): threaded review replies, embedded-in-thread comments, and minimized/collapsed states. The
CommentCardhelper already has anisReplyprop wired (drops the container border/caret/gutter avatar) so those can be added later without reshaping the helper.Source of truth
Recreated from the live React components in github-ui
packages/commenting(ActivityHeader,CommentAuthorAssociation,CommentSubjectAuthor,IssueComment). Key denotations were verified against live, not invented:bot/AI— fromLABELS.authorLabel(isBot, isCopilot)(botfor bots/Dependabot,AIfor Copilot, name shown as "Copilot"). Not "Bot"/"Copilot".Authorbadge is the subject-author badge (CommentSubjectAuthor,LABELS.commentAuthor), shown when the commenter opened the issue — distinct from association values (Member/Owner/Collaborator/Contributor).inline(underlined) link.Avatar shape decision
ActivityHeaderonly forcessquare={isCopilot}, which avoids overriding an already-square bot avatar; it does not make bots render circular in production.CommentBot/CommentDependabotvariants so it isn't accidentally "fixed" back to circle.Faithfulness note
There is no Primer "Comment" primitive, so the card shell, header bar, speech-bubble caret, and reaction pills are composed from Primer primitives (
Avatar,Link,Label,RelativeTime,IconButton) plus a scoped CSS module. This surface is intentionally a recognizable GitHub comment card, less pixel-faithful than the badge-row surfaces.Slots
Uses
Timeline.Item+Timeline.Avatarfor the gutter/rail (the comment uses the gutter avatar, noTimeline.Badge). A file-scopedprimer_react_timeline_list_semanticsdecorator renders every story in the future-state list-semantics DOM (<ol>/<li>; refs #7910).Storybook-only
Like the other Phase 2 event surfaces, these are intentionally not wired into components-json / the primer.style docs page (not added to
Timeline.docs.jsonorbuild.ts). Individual timeline events are not consumer-facing components.Changelog
New
Timeline.comments.features.stories.tsx):CommentStandard,CommentBot,CommentCopilot,CommentDependabot,CommentViaApp.Changed
Removed
Rollout strategy
skip changesetlabel is applied.Testing & Reviewing
Comment*stories).Merge checklist