Skip to content

Fix Alert banner variant to use Carbon icons#7627

Merged
gilluminate merged 4 commits intomainfrom
gill/ENG-2891/alert-banner-carbon-icons
Mar 12, 2026
Merged

Fix Alert banner variant to use Carbon icons#7627
gilluminate merged 4 commits intomainfrom
gill/ENG-2891/alert-banner-carbon-icons

Conversation

@gilluminate
Copy link
Contributor

@gilluminate gilluminate commented Mar 11, 2026

Ticket ENG-2891

Description Of Changes

Fix the Alert banner variant to use Carbon icons instead of Ant's built-in icons. The initial Carbon icon integration (PR #7613) missed the banner case because Ant's banner prop implicitly enables icon display and defaults to type="warning" internally, but our HOC was gating icon injection on the explicit showIcon prop and defaulting type to "info".

This mirrors Ant's internal banner defaults in the CustomAlert HOC:

  • showIcon resolves to true when banner is set and showIcon isn't explicitly provided
  • type resolves to "warning" when banner is set and type isn't explicitly provided

Code Changes

  • clients/fidesui/src/hoc/CustomAlert.tsx - Destructure banner prop; compute resolvedType and resolvedShowIcon mirroring Ant's internal defaults; use resolved values for Carbon icon injection and prop passthrough; update JSDoc

Steps to Confirm

  1. Run Storybook: cd clients/fidesui && npm run storybook
  2. Navigate to Feedback > Alert > Banner story - should show Carbon WarningFilled icon (not Ant's ExclamationCircleFilled)
  3. Verify Banner with explicit type="info" shows Carbon InformationFilled
  4. Verify Banner with showIcon={false} hides icon entirely
  5. Verify non-banner stories (Info, Error, Success, Warning, Compact, Closable) still render correctly

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • No UX review needed
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

@vercel
Copy link
Contributor

vercel bot commented Mar 11, 2026

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

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Mar 12, 2026 5:36pm
fides-privacy-center Ignored Ignored Mar 12, 2026 5:36pm

Request Review

gilluminate added a commit that referenced this pull request Mar 11, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mirror Ant's internal banner defaults (showIcon=true, type="warning")
in the CustomAlert HOC so Carbon icons are injected for banner mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gilluminate gilluminate force-pushed the gill/ENG-2891/alert-banner-carbon-icons branch from 16b0a6e to 6fdb29a Compare March 11, 2026 18:24
@gilluminate gilluminate marked this pull request as ready for review March 11, 2026 18:25
@gilluminate gilluminate requested a review from a team as a code owner March 11, 2026 18:25
@gilluminate gilluminate changed the title ENG-2891: Fix Alert banner variant to use Carbon icons Fix Alert banner variant to use Carbon icons Mar 11, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 11, 2026

Greptile Summary

This PR fixes the CustomAlert HOC so that banner-mode alerts use Carbon icons instead of falling back to Ant Design's built-in ExclamationCircleFilled. The root cause was that the HOC gated icon injection on the explicit showIcon prop and defaulted type to "info", while Ant's banner prop implicitly enables showIcon and defaults type to "warning" internally.

Changes:

  • Destructures the banner prop and computes resolvedType (type ?? (banner ? "warning" : "info")) and resolvedShowIcon (showIcon ?? !!banner), mirroring Ant's internal defaults.
  • Carbon icon selection and all prop passthrough now use the resolved values, ensuring banner alerts get the WarningFilled Carbon icon by default.
  • Explicit showIcon={false} on a banner alert is still correctly respected (since false ?? true evaluates to false via nullish coalescing).
  • JSDoc updated to document the banner-mode behavior.

The implementation is clean, well-reasoned, and handles all relevant edge cases correctly.

Confidence Score: 5/5

  • This PR is safe to merge — it's a focused, correct bug fix with no side effects on existing non-banner usage.
  • The change is minimal (one file, ~15 lines), logically sound, and all edge cases (explicit showIcon={false}, explicit type, custom icon, non-banner alerts) continue to behave correctly due to proper use of nullish coalescing. The fix faithfully mirrors Ant Design's internal banner defaults.
  • No files require special attention.

Important Files Changed

Filename Overview
clients/fidesui/src/hoc/CustomAlert.tsx Correctly mirrors Ant Design's internal banner defaults by computing resolvedType and resolvedShowIcon before Carbon icon injection; fix is logically sound with no edge-case issues.

Last reviewed commit: 6fdb29a

Copy link
Contributor

@speaker-ender speaker-ender left a comment

Choose a reason for hiding this comment

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

Approving as is but I'm leaning towards ignoring ant's defaults since they don't have a clear rationale imo.

Comment on lines +11 to +17
({ showIcon, icon, type, banner, description, ...props }, ref) => {
// Mirror Ant's internal defaults so Carbon icons apply correctly:
// - banner mode defaults type to "warning" (not "info")
// - banner mode implicitly enables showIcon
const resolvedType = type ?? (banner ? "warning" : "info");
const resolvedShowIcon = showIcon ?? !!banner;

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm open to disagreeing with ant's implementation here and choosing our own sane defaults since we are wrapping this.
It seems odd and unintuitive that the default type and showIcon values are different based on the banner prop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like your thinking! Simplified so all alert types behave consistently - type defaults to "info" and showIcon defaults to false across the board, overriding Ant's banner-specific defaults (type="warning", showIcon=true). No existing banner usages in the codebase, so this is a safe change.

gilluminate and others added 3 commits March 12, 2026 10:22
Override Ant's banner-specific defaults so all alert types
behave identically (type="info", showIcon=false).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gilluminate gilluminate added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit e6025e8 Mar 12, 2026
44 of 45 checks passed
@gilluminate gilluminate deleted the gill/ENG-2891/alert-banner-carbon-icons branch March 12, 2026 18:08
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