Skip to content

feat: add announcements banner#2549

Merged
wassimoo merged 7 commits into
masterfrom
feat/add-announcements-banner
May 13, 2026
Merged

feat: add announcements banner#2549
wassimoo merged 7 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

    • Dismissable announcement banners appear at the top of pages and remember dismissal across visits.
    • Multiple announcement levels provide distinct visual styling.
  • Style

    • Announcement links are underlined and change color on hover for clearer affordance.
  • Chore

    • Announcement banner integrated into the site root so it renders site-wide.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 176d5dee-3ee6-4436-8e84-fd6ca76d1ad5

📥 Commits

Reviewing files that changed from the base of the PR and between b8dae8a and 9b8d346.

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

📝 Walkthrough

Walkthrough

Adds a dismissible AnnouncementBanner component (MDX-driven) with per-announcement localStorage dismissal, styled banner link rules, and unconditional insertion of the banner at the top of the Root layout.

Changes

Announcement Banner Feature

Layer / File(s) Summary
Types and helper functions
src/components/AnnouncementBanner/AnnouncementBanner.tsx
AnnouncementLevel and helpers map levels to Tailwind-like classes and build localStorage keys for announcement dismissal.
Component state and initialization
src/components/AnnouncementBanner/AnnouncementBanner.tsx
Component imports announcement data from MDX, manages ready and dismissed state, and reads dismissal state from localStorage on mount while tolerating storage errors.
Render logic and dismissal
src/components/AnnouncementBanner/AnnouncementBanner.tsx
Early-return conditions for disabled/missing id/not-ready/dismissed; renders banner UI and a dismiss button that updates state and writes a dismissal flag to localStorage (errors ignored).
Link styling
src/components/AnnouncementBanner/AnnouncementBanner.module.css
Adds .announcementContent a rules: underlined links with underline-offset and a color transition; hover state changes link color to #581c87.
Root layout integration
src/theme/Root.js
Imports AnnouncementBanner and inserts <AnnouncementBanner /> at the start of the Root fragment render before {children} and the Kapa widget.

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant Root
  participant AnnouncementBanner
  participant LocalStorage
  Browser->>Root: load page
  Root->>AnnouncementBanner: mount component
  AnnouncementBanner->>LocalStorage: read 'ory_docs_announcement_dismissed:{id}'
  LocalStorage-->>AnnouncementBanner: return flag or error
  AnnouncementBanner-->>Browser: render banner (or null)
  Browser->>AnnouncementBanner: click dismiss
  AnnouncementBanner->>LocalStorage: write '1' to key
  LocalStorage-->>AnnouncementBanner: write ack or error
  AnnouncementBanner-->>Browser: hide banner
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped into Root with a banner so bright,
Purple links that shimmer when they catch the light,
A gentle close that remembers what you choose,
LocalStorage listens quietly and won't refuse,
Now docs wear a ribbon you can hide with delight.

🚥 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 pull request description covers the main feature, includes implementation details, and completes most checklist items, but does not reference a related issue or design document as required by the template. Link to a related issue or design document (e.g., #issue-number) in the 'Related Issue or Design Document' section to fully comply with the repository template.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title 'feat: add announcements banner' directly and clearly summarizes the main change—adding a new AnnouncementBanner component to the documentation site.
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

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.

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

Copy link
Copy Markdown
Contributor

@unatasha8 unatasha8 left a comment

Choose a reason for hiding this comment

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

LGTM

@wassimoo wassimoo merged commit dc41be4 into master May 13, 2026
12 checks passed
@wassimoo wassimoo deleted the feat/add-announcements-banner branch May 13, 2026 09:55
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.

3 participants