Skip to content

ENG-2889: Replace Ant default icons with Carbon icons in Modal methods#7569

Open
gilluminate wants to merge 9 commits intomainfrom
gill/ENG-2889/modal-carbon-icons
Open

ENG-2889: Replace Ant default icons with Carbon icons in Modal methods#7569
gilluminate wants to merge 9 commits intomainfrom
gill/ENG-2889/modal-carbon-icons

Conversation

@gilluminate
Copy link
Contributor

@gilluminate gilluminate commented Mar 4, 2026

Ticket ENG-2889

Description Of Changes

Replace Ant Design's default icons in the imperative Modal API (modalApi.info(), .success(), .error(), .warning(), .confirm()) with Carbon icon equivalents from @carbon/icons-react, consistent with the rest of the FidesUI design system.

The useModal hook in FidesUIProvider now wraps the modal API to inject Carbon icons as defaults. Callers can still override with a custom icon prop or suppress with icon: null.

Scope is limited to Modal methods only — message and notification APIs will follow in a future ticket.

Code Changes

  • clients/fidesui/src/lib/carbon-icon-defaults.tsx - New icon map module mapping modal types to Carbon icons (InformationFilled, CheckmarkFilled, WarningFilled, Misuse) with fidesui palette colors
  • clients/fidesui/src/FidesUIProvider.tsx - Wrap modalApi to inject default Carbon icons for each modal method
  • clients/fidesui/src/components/feedback/ModalMethods.stories.tsx - New Storybook stories for all 5 modal method types with hideIcon toggle

Steps to Confirm

  1. Open Storybook (npm run storybook in clients/fidesui)
  2. Navigate to Feedback > Modal Methods in the sidebar
  3. Click through each story (Info, Success, Warning, Error, Confirm) and verify Carbon icons render with correct colors
  4. Toggle the hideIcon control in the Controls panel to verify icon: null suppresses the icon
  5. Verify that existing icon: null call sites (e.g., in useRemoveCustomIntegration.tsx, PolicyConditionsTab.tsx) still suppress icons 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:
    • All UX related changes have been reviewed by a designer
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Modal actions (info, success, warning, error, confirm) now display default Carbon icons automatically.
  • Documentation

    • Added Storybook stories demonstrating each modal method with configurable title, content, type, and icon visibility.
  • Changelog

    • Added an entry documenting the Developer Experience change for modal icon defaults.

@vercel
Copy link
Contributor

vercel bot commented Mar 4, 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 6, 2026 9:40pm
fides-privacy-center Ignored Ignored Mar 6, 2026 9:40pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Wraps Ant Modal imperative methods with defaults to inject Carbon icons; adds a shared icon utility and Storybook stories demonstrating each modal method.

Changes

Cohort / File(s) Summary
Changelog
changelog/7569-modal-carbon-icons.yaml
New changelog entry documenting the Developer Experience change adding Carbon icon defaults for Ant Modal imperative API methods.
Icon Utilities
clients/fidesui/src/lib/carbon-icon-defaults.tsx
New module exporting getDefaultModalIcon(type: string): ReactNode, an ICON_SIZE, a MODAL_ICON_MAP, and an internal icon wrapper to render Carbon icons in a non-shrinking Flex container.
Provider Integration
clients/fidesui/src/FidesUIProvider.tsx
Introduces wrappedModalApi (memoized) that augments modal methods (info, success, warning, error, confirm) to inject default icons via getDefaultModalIcon, and exposes wrappedModalApi through the context instead of the raw modalApi.
Storybook
clients/fidesui/src/components/feedback/ModalMethods.stories.tsx
New Storybook stories introducing a ModalMethod component and five stories (Info, Success, Warning, Error, Confirm) that call the modal API with configurable title, content, and optional icon visibility.

Sequence Diagram(s)

sequenceDiagram
    rect rgba(200,230,255,0.5)
    participant Consumer as Component (useModal)
    end
    rect rgba(220,255,220,0.5)
    participant Provider as FidesUIProvider
    end
    rect rgba(255,240,200,0.5)
    participant IconUtil as carbon-icon-defaults
    participant AntModal as Ant Modal API
    end

    Consumer->>Provider: request modal methods from context
    Provider->>Consumer: returns wrappedModalApi (info/success/warning/error/confirm)
    Consumer->>Provider: call wrappedModalApi.info(args)
    Provider->>IconUtil: getDefaultModalIcon(type="info")
    IconUtil-->>Provider: ReactNode (icon)
    Provider->>AntModal: call modalApi.info(args + icon)
    AntModal-->>Provider: modal opened
    Provider-->>Consumer: modal opened confirmation
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped into code with nimble paws,
Tucked Carbon icons into modal laws,
Wrapped the calls so dialogs glow,
Stories show each tiny bow,
A little hop, and UX applause.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: replacing Ant Design icons with Carbon icons in Modal methods, with direct reference to the ticket.
Description check ✅ Passed The pull request description follows the template with all major sections completed: issue ticket, description of changes, code changes list, steps to confirm, and pre-merge checklist with appropriate selections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gill/ENG-2889/modal-carbon-icons

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

gilluminate added a commit that referenced this pull request Mar 4, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gilluminate gilluminate marked this pull request as ready for review March 4, 2026 23:27
@gilluminate gilluminate requested a review from a team as a code owner March 4, 2026 23:27
@gilluminate gilluminate requested review from speaker-ender and removed request for a team March 4, 2026 23:27
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 4, 2026

Greptile Summary

This PR replaces Ant Design's default icons in the imperative Modal API (info, success, error, warning, confirm) with Carbon icon equivalents, keeping the FidesUI design system consistent. The approach — wrapping modalApi in FidesUIProvider via useMemo and injecting defaults before spreading caller props — is clean and well-contained, and correctly preserves the ability to suppress icons with icon: null.

Key points:

  • FidesUIProvider.tsx: Straightforward useMemo wrapping of modalApi. The default icon is placed before ...props in each method, so callers can override or suppress it as expected.
  • carbon-icon-defaults.tsx: Icon ReactNodes are created once at module load time and reused across calls. This is harmless for static nodes but is a non-standard React pattern; lazily creating a new element per call would be safer.
  • ModalMethods.stories.tsx: The useEffect intentionally uses [] to open the modal on mount, but this means Storybook's Controls panel changes (e.g. toggling hideIcon) will not re-trigger the effect — undermining the described manual test for hideIcon.

Confidence Score: 4/5

  • Safe to merge with a minor fix to the Storybook story's useEffect dependencies.
  • The core production change (FidesUIProvider wrapping and carbon-icon-defaults) is small, correct, and non-breaking. The only real concern is the Storybook story's empty useEffect dependency array, which makes the hideIcon control non-functional and doesn't reflect intent accurately, but this does not affect any production code.
  • clients/fidesui/src/components/feedback/ModalMethods.stories.tsx — the missing useEffect dependencies should be addressed.

Important Files Changed

Filename Overview
clients/fidesui/src/lib/carbon-icon-defaults.tsx New module mapping modal types to Carbon icon ReactNodes. Icons are pre-rendered at module load time and shared across calls — functional but a non-standard React pattern worth noting.
clients/fidesui/src/FidesUIProvider.tsx Wraps modalApi in a useMemo to inject Carbon icon defaults before spreading caller props, correctly allowing icon: null overrides. Clean, well-scoped change.
clients/fidesui/src/components/feedback/ModalMethods.stories.tsx New Storybook stories for all 5 modal method types. The useEffect uses an empty dependency array, preventing the modal from re-triggering when Storybook Controls args change — this breaks the hideIcon toggle test described in the PR.
changelog/7569-modal-carbon-icons.yaml Changelog entry for the PR. No issues.

Last reviewed commit: fe88a6d

Copy link

@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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/fidesui/src/components/feedback/ModalMethods.stories.tsx`:
- Line 5: The story imports PARAGRAPH_LOREM and TITLE_LOREM which contain a real
organization name; update ModalMethods.stories.tsx to remove that dependency and
replace usage of PARAGRAPH_LOREM and TITLE_LOREM with neutral placeholder copy
(either new constants like GENERIC_PARAGRAPH / GENERIC_TITLE defined locally in
the story or inline neutral strings such as "example_org" / generic lorem) so no
real customer/org names remain; ensure all references to PARAGRAPH_LOREM and
TITLE_LOREM in the ModalMethods story are replaced accordingly.
- Around line 20-26: The useEffect currently has an empty dependency array but
relies on modalApi, type, title, content, and hideIcon—update the effect to
include [modalApi, type, title, content, hideIcon] so Storybook arg changes
retrigger the modal; also implement cleanup by calling the modal instance's
destroy() (Modal.useModal() returns a ref with destroy) when the effect
unmounts/changes. Replace the imported PARAGRAPH_LOREM string that contains
"Ethyca" with a generic placeholder text (e.g., neutral lorem ipsum) so the
story no longer contains organization-specific content. Ensure references to
modalApi, type, title, content, hideIcon, PARAGRAPH_LOREM, and
Modal.useModal()/destroy() are updated accordingly.

In `@clients/fidesui/src/lib/carbon-icon-defaults.tsx`:
- Line 7: Import CarbonIconType from the package root instead of the internal
path: replace the import reference to "@carbon/icons-react/lib/CarbonIcon" with
the public export from "@carbon/icons-react" so the CarbonIconType symbol is
pulled from the package's public API (update the import that currently names
CarbonIconType to import it directly from "@carbon/icons-react").

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19ba7959-ce68-4a24-820a-62f177f45b08

📥 Commits

Reviewing files that changed from the base of the PR and between 41f7587 and fe88a6d.

📒 Files selected for processing (4)
  • changelog/7569-modal-carbon-icons.yaml
  • clients/fidesui/src/FidesUIProvider.tsx
  • clients/fidesui/src/components/feedback/ModalMethods.stories.tsx
  • clients/fidesui/src/lib/carbon-icon-defaults.tsx

Copy link

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/fidesui/src/lib/carbon-icon-defaults.tsx`:
- Line 8: The import is using Ant Design's internal path ("antd/lib") for the
Flex symbol; update the import to use Ant Design's public entrypoint instead by
replacing the current import of Flex (the Flex symbol) with an import from
"antd" so the module uses the documented public API rather than internal CJS
paths.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ec38c06b-fcae-4a04-8dc9-fc7a2af9f3e4

📥 Commits

Reviewing files that changed from the base of the PR and between d37b5db and 470dcc4.

📒 Files selected for processing (1)
  • clients/fidesui/src/lib/carbon-icon-defaults.tsx

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.

Minor nits but otherwise looking great!

Comment on lines +47 to +56
info: (props: Parameters<typeof modalApi.info>[0]) =>
modalApi.info({ icon: getDefaultModalIcon("info"), ...props }),
success: (props: Parameters<typeof modalApi.success>[0]) =>
modalApi.success({ icon: getDefaultModalIcon("success"), ...props }),
error: (props: Parameters<typeof modalApi.error>[0]) =>
modalApi.error({ icon: getDefaultModalIcon("error"), ...props }),
warning: (props: Parameters<typeof modalApi.warning>[0]) =>
modalApi.warning({ icon: getDefaultModalIcon("warning"), ...props }),
confirm: (props: Parameters<typeof modalApi.confirm>[0]) =>
modalApi.confirm({ icon: getDefaultModalIcon("confirm"), ...props }),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not now but at some point might want to handle this with some kind of transform function since we probably need this type of pattern for notifications and messages at some point

gilluminate and others added 9 commits March 6, 2026 14:39
Wrap the useModal hook in FidesUIProvider to inject Carbon icon
equivalents (InformationFilled, CheckmarkFilled, WarningFilled, Misuse)
as defaults for info, success, warning, error, and confirm modals.
Callers can still override with icon prop or suppress with icon: null.

Add Modal Methods Storybook stories for visual verification.

ENG-2889

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add useEffect dependencies and destroy() cleanup in stories
- Use public import path for CarbonIconType
- Add hideIcon default arg to all stories, remove standalone NoIcon story

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unnecessary modalApi spread in FidesUIProvider
- Nest modal method stories under Feedback/Modal/Methods
- Add Primary story pattern with type control disabled on variants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gilluminate gilluminate force-pushed the gill/ENG-2889/modal-carbon-icons branch from cbbe49d to 2666242 Compare March 6, 2026 21:39
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