Skip to content

feat: add announcements banner#2549

Open
wassimoo wants to merge 3 commits into
masterfrom
feat/add-announcements-banner
Open

feat: add announcements banner#2549
wassimoo wants to merge 3 commits into
masterfrom
feat/add-announcements-banner

Conversation

@wassimoo
Copy link
Copy Markdown
Contributor

@wassimoo wassimoo commented May 11, 2026

Description

Adds a new AnnouncementBanner component to the Ory documentation site. This component allows displaying persistent, dismissable announcement messages at the top of the page with configurable styling levels (info, warning, error, success).

The announcement banner is configurable via a simple MDX file, making it easy for content editors to create and manage announcements without code changes.

The banner respects user dismissal preferences using localStorage, so users won't see the same announcement repeatedly after closing it.

Features

  • Configurable Levels: Support for info (purple), warning (amber), error (red), and success (emerald) themes
  • Dismissable: Users can close the banner; their preference is saved in localStorage
  • Responsive: Works across all screen sizes with proper padding and spacing
image

Component Details

  • Location: src/components/AnnouncementBanner/
  • Configuration: Edit src/content/announcement-banner.mdx to control:
    • enabled: Toggle banner on/off
    • id: Unique identifier (change for each new announcement)
    • level: Visual emphasis level
    • Content: Plain markdown with support for links

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have added the necessary documentation and styling within the code base.
  • The component is properly integrated into the Root layout.

Summary by CodeRabbit

  • New Features
    • New dismissable announcement banners display at the top of the page to share important updates with users
    • Once dismissed, announcements remain hidden on future visits thanks to automatic preference saving
    • Multiple announcement types feature distinct visual styling to help users quickly identify priority levels

Review Change Stack

@wassimoo wassimoo changed the title Feat/add announcements banner feat: add announcements banner May 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

📝 Walkthrough

Walkthrough

A new dismissible announcement banner component is added to the documentation site. The component reads configuration from MDX, tracks dismissal state per announcement in localStorage with error tolerance, renders conditionally based on enabled/dismissed/ready status, and integrates into the root layout before existing content. Link styling is applied within the banner.

Changes

Announcement Banner Feature

Layer / File(s) Summary
Types and Helper Functions
src/components/AnnouncementBanner/AnnouncementBanner.tsx
AnnouncementLevel type defined for "info", "warning", "error", "success". Helper functions map levels to Tailwind classes and construct localStorage keys using announcement id.
Component State and Initialization
src/components/AnnouncementBanner/AnnouncementBanner.tsx
Component imports announcement config from MDX, initializes ready and dismissed state, and reads dismissal flag from localStorage on mount using a deterministic key, tolerating access errors.
Render Logic and Dismissal
src/components/AnnouncementBanner/AnnouncementBanner.tsx
Renders banner conditionally returning null if disabled, missing id, not ready, or already dismissed. Dismiss button updates both React state and localStorage with error swallowing.
Link Styling
src/components/AnnouncementBanner/AnnouncementBanner.module.css
CSS rules for .announcementContent a apply underline styling with offset and color transition. Hover state changes link color to #581c87.
Root Layout Integration
src/theme/Root.js
AnnouncementBanner component is imported and rendered at the top of the root layout fragment before {children} and KapaWidget.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A banner hops into the root so bright,
With dismiss and localStorage keeping sight,
Links styled in purple on hover's delight,
Announcements that vanish when clicked just right! 📢✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is comprehensive and includes features, component details, and configuration information, but is missing required sections like 'Related Issue or Design Document' and several unchecked items from the checklist template. Add a 'Related Issue or Design Document' section linking to the design/feature issue (#2549 mentioned in objectives). Clarify which checklist items were completed versus intentionally omitted.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add announcements banner' clearly and concisely describes the main change: adding a new announcement banner feature.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-announcements-banner

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/AnnouncementBanner/AnnouncementBanner.module.css (1)

7-9: ⚡ Quick win

Avoid hardcoded hover color across banner levels

On Line 8, forcing link hover to #581c87 overrides the level-specific theme colors (warning/error/success), which can make the banner feel visually inconsistent. Prefer inheriting the level text color (or making hover color level-aware).

Proposed change
 .announcementContent a:hover {
-  color: `#581c87`;
+  color: currentColor;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/AnnouncementBanner/AnnouncementBanner.module.css` around lines
7 - 9, The rule .announcementContent a:hover in AnnouncementBanner.module.css
hardcodes hover color `#581c87` which overrides level-specific themes; change it
to use the level-aware color (e.g., color: inherit or color:
var(--announcement-text-color)) so link hover inherits the banner's text color
(or a CSS variable set per level: warning/error/success) rather than forcing
`#581c87`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components/AnnouncementBanner/AnnouncementBanner.module.css`:
- Around line 7-9: The rule .announcementContent a:hover in
AnnouncementBanner.module.css hardcodes hover color `#581c87` which overrides
level-specific themes; change it to use the level-aware color (e.g., color:
inherit or color: var(--announcement-text-color)) so link hover inherits the
banner's text color (or a CSS variable set per level: warning/error/success)
rather than forcing `#581c87`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fe223963-d966-43f8-a58c-4befe46f22f5

📥 Commits

Reviewing files that changed from the base of the PR and between 2c4e95d and ca486e7.

⛔ Files ignored due to path filters (1)
  • src/content/announcement-banner.mdx is excluded by !**/*.mdx
📒 Files selected for processing (3)
  • src/components/AnnouncementBanner/AnnouncementBanner.module.css
  • src/components/AnnouncementBanner/AnnouncementBanner.tsx
  • src/theme/Root.js

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.

2 participants