Skip to content

feat: [announcement-bar] add dismissible support and accept node text - #930

Open
rohanchkrabrty wants to merge 1 commit into
mainfrom
feat/announcement-bar-dismissible
Open

rohanchkrabrty wants to merge 1 commit into
mainfrom
feat/announcement-bar-dismissible

Conversation

@rohanchkrabrty

Copy link
Copy Markdown
Contributor

Summary

  • Add dismissible and onDismiss, with the same behavior as Callout. dismissible shows a close button. Without onDismiss, the bar hides itself. With onDismiss, the bar stays mounted and the consumer removes it.
  • The close button reuses the action button styles and sits at the inline end, so the message stays centered. It has aria-label="Dismiss announcement" and the announcement-bar-dismiss slot.
  • text accepts ReactNode instead of string, so it can hold links or bold text.
  • Tone variants (warning, success, info) are left out because Figma has only Normal, Error, and Gradient.
  • Docs: add a Dismissible section, the dismiss slot, and the dismissible, onDismiss, and onActionClick props.

Closes #596

@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
apsara Ready Ready Preview Sep 29, 2026 1:52pm UTC

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 6c1b1815-2c5e-41c9-8afa-ec1394267c10

📥 Commits

Reviewing files that changed from the base of the PR and between d088032 and 164da50.

📒 Files selected for processing (7)
  • apps/www/src/content/docs/components/announcement-bar/demo.ts
  • apps/www/src/content/docs/components/announcement-bar/index.mdx
  • apps/www/src/content/docs/components/announcement-bar/props.ts
  • packages/raystack/components/announcement-bar/__tests__/announcement-bar.test.tsx
  • packages/raystack/components/announcement-bar/__tests__/data-slots.test.tsx
  • packages/raystack/components/announcement-bar/announcement-bar.module.css
  • packages/raystack/components/announcement-bar/announcement-bar.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

AnnouncementBar text now accepts ReactNode content. The component supports optional dismissal through a close button. Without an onDismiss callback, clicking the button hides the bar; with a callback, the component calls it and remains mounted. Tests and documentation cover these behaviors, the dismiss slot, and the button’s accessibility details.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant AnnouncementBar
  participant DismissHandler as onDismiss callback
  User->>AnnouncementBar: Click dismiss button
  alt onDismiss is provided
    AnnouncementBar->>DismissHandler: Call callback
    Note over AnnouncementBar: Bar remains mounted
  else onDismiss is omitted
    AnnouncementBar->>AnnouncementBar: Set dismissed state and render nothing
  end
Loading

Suggested reviewers: ravisuhag

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 164da

The dismissal feature appears ready to merge after normal checks; no actionable issue remains from this review.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 164da

The observed change is confined to UI rendering and dismissal. No privileged operation or security boundary crossing was identified, although use by downstream applications is not fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced change affects the shared component contract and its documentation. No production consumer or wider attacker-controlled route is established by the supplied relationships.

Trust Boundaries and Controls

  • observed — Dismissal requires a rendered button click. The component does not derive its callback from text: it uses the callback supplied by its caller or changes only local presentation state.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue [#596] requires dismissible/onDismiss support and ReactNode text. The PR implements both behaviors and adds automated tests for them. The announcementBar variable is already correctly spelled … Implement warning, success, and info variants with their styles, public prop documentation, and automated coverage, or update [#596] if those variants are intentionally removed from its scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: dismissible support and acceptance of node text for AnnouncementBar.
Description check ✅ Passed The description is directly related to the changeset and explains the new dismissal behavior, ReactNode support, styling, accessibility, slots, and documentation updates.
Out of Scope Changes check ✅ Passed The changed component code, CSS positioning, automated tests, and AnnouncementBar documentation support the dismissible behavior and ReactNode text requirements in [#596]. No unrelated change is demon…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
Full details: Linked Issues check

Explanation

Issue [#596] requires dismissible/onDismiss support and ReactNode text. The PR implements both behaviors and adds automated tests for them. The announcementBar variable is already correctly spelled in the merge base, so that requirement was already satisfied. However, the reviewed head still defines only normal, gradient, and error; warning, success, and info variants are not implemented or tested.

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@raystack/apsara@930

commit: 164da50

}

/* Out of the flex flow so the message stays centered in the bar. */
.dismiss {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The X fits exactly inside the right padding, so long text runs right up to it with no gap. Maybe add a bit more right padding when dismissible is set.

{leadingIcon}
</span>
)}
<Text

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(suggestion)

Now that text can be any element, it's still wrapped in a <span>, so passing a <div> or <p> isn't valid HTML. Could you render it as a <div> instead? Text supports render:

<Text
  render={<div />}
  className={styles.text}
  size='small'
  weight='medium'
  data-slot='announcement-bar-text'
>
  {text}
</Text>

The layout stays the same since it's a flex item either way.

This branch was successfully deployed

1 active deployment
Preview — 164da50d Deployed Sep 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AnnouncementBar] Add variants, dismissible support, and fix typo

2 participants