Add Timeline comment-card Storybook stories (Issues surface)#8072
Draft
janmaarten-a11y wants to merge 3 commits into
Draft
Add Timeline comment-card Storybook stories (Issues surface)#8072janmaarten-a11y wants to merge 3 commits into
janmaarten-a11y wants to merge 3 commits into
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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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