diff --git a/packages/review/app/src/review-home-styles.ts b/packages/review/app/src/review-home-styles.ts index 7c4c1ce52..46a207aa3 100644 --- a/packages/review/app/src/review-home-styles.ts +++ b/packages/review/app/src/review-home-styles.ts @@ -270,6 +270,8 @@ export const styles = stylex.create({ lineHeight: leading.px22, }, parentTitle: { fontWeight: fontWeight.medium }, + // Trails the title's last word, as a PR list writes it. + pullRequestNumber: { marginLeft: space.s8 }, nestedRow: { paddingLeft: space.s48 }, nestedConnector: { position: "absolute", diff --git a/packages/review/app/src/review-home-view.tsx b/packages/review/app/src/review-home-view.tsx index 0a86b9720..d41fe2088 100644 --- a/packages/review/app/src/review-home-view.tsx +++ b/packages/review/app/src/review-home-view.tsx @@ -1,4 +1,8 @@ -import { BoardIcon, PullRequestStateIcon } from "@canvas/ui/board-icons"; +import { + BoardIcon, + PullRequestNumber, + PullRequestStateIcon, +} from "@canvas/ui/board-icons"; import { CopyableText, copyText } from "@canvas/ui/copy"; import { CrumbSeparator } from "@canvas/ui/crumbs"; import { DisclosureChevron, disclosureStyles } from "@canvas/ui/disclosure"; @@ -1816,6 +1820,12 @@ function HomeBoardTitle({ )} > + {review.origin?.pullRequestNumber ? ( + + ) : null} ); diff --git a/packages/review/app/src/sidebar-sections.tsx b/packages/review/app/src/sidebar-sections.tsx index 3d88be2a3..67cccd639 100644 --- a/packages/review/app/src/sidebar-sections.tsx +++ b/packages/review/app/src/sidebar-sections.tsx @@ -1,5 +1,9 @@ import { BoardDisclosure } from "@canvas/ui/board-disclosure"; -import { BoardIcon, PullRequestStateIcon } from "@canvas/ui/board-icons"; +import { + BoardIcon, + PullRequestNumber, + PullRequestStateIcon, +} from "@canvas/ui/board-icons"; import { IconButton, buttonStyles } from "@canvas/ui/button"; import { CrumbSeparator } from "@canvas/ui/crumbs"; import { EmptyState } from "@canvas/ui/empty-state"; @@ -222,6 +226,7 @@ function BoardRow({ }): ReactElement { const [childError, setChildError] = useState(""); const isCurrent = board.reviewId === current; + const prNumber = board.origin?.pullRequestNumber; const newChild = onNewChild && canAddChildWhiteboard(board) ? onNewChild : undefined; @@ -301,7 +306,10 @@ function BoardRow({ )} {parentTitle ? ( @@ -341,11 +349,18 @@ function BoardRow({ )} - {board.origin?.pullRequestNumber ? ( - + {prNumber ? ( + <> + {/* The "+" for a child board sits between number and icon. */} + + + ) : null} {newChild ? ( @@ -355,7 +370,7 @@ function BoardRow({ onError={setChildError} xstyle={[ styles.childAction, - !!board.origin?.pullRequestNumber && styles.childActionWithPr, + !!prNumber && styles.childActionWithPr, ]} /> ) : null} diff --git a/packages/review/app/src/ui/board-icons.tsx b/packages/review/app/src/ui/board-icons.tsx index d62926af8..3babea32b 100644 --- a/packages/review/app/src/ui/board-icons.tsx +++ b/packages/review/app/src/ui/board-icons.tsx @@ -1,3 +1,4 @@ +import { fontSize } from "@canvas/scale.stylex"; import { tokens } from "@canvas/tokens.stylex"; import { useTooltip } from "@canvas/ui/tooltip"; import { @@ -93,6 +94,22 @@ export function PullRequestStateIcon({ ); } +/** "#908", the PR number a list row shows beside its state icon. The icon + * already names the PR to assistive tech, so this is hidden from it. */ +export function PullRequestNumber({ + number, + xstyle, +}: { + number: number; + xstyle?: stylex.StyleXStyles; +}): ReactElement { + return ( + + ); +} + const styles = stylex.create({ icon: { flexShrink: 0, @@ -105,6 +122,15 @@ const styles = stylex.create({ kind: { color: tokens.inkMuted }, current: { color: tokens.accent }, state: { display: "inline-flex", flexShrink: 0 }, + // As a terminal prints it; digits keep their width down a list. + number: { + flexShrink: 0, + color: tokens.inkFaint, + fontFamily: tokens.fontMono, + fontSize: fontSize.small, + fontVariantNumeric: "tabular-nums", + whiteSpace: "nowrap", + }, }); const stateStyles = stylex.create({