chore: centralize SVG icon assets in design-system-shared (Phase 1)#1084
Conversation
Moves the single source of truth for all icon SVG assets into packages/design-system-shared/src/assets/icons/. - Copies 279 SVGs from design-system-react-native/src/components/Icon/assets/ into the new shared location - Updates design-system-react-native generate-icons script to read SVGs from shared, then copy (with black→currentColor processing) to the local RN assets folder so the published RN package output is unchanged - Updates design-system-react generate-icons script to run svgr against the shared SVGs instead of its own local assets/ folder No public API changes. Both platform packages continue to ship the same generated files as before.
📖 Storybook Preview |
📖 Storybook Preview |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: React package loses PopUp and SidePanel icons
- Regenerated React icons from shared SVGs, restoring PopUp/SidePanel components, updating icons/index.ts, and re-adding both to the IconName enum.
Or push these changes by commenting:
@cursor push 79c788c442
Preview (79c788c442)
diff --git a/packages/design-system-react/src/components/Icon/icons/PopUp.tsx b/packages/design-system-react/src/components/Icon/icons/PopUp.tsx
new file mode 100644
--- /dev/null
+++ b/packages/design-system-react/src/components/Icon/icons/PopUp.tsx
@@ -1,0 +1,6 @@
+import * as React from "react";
+import type { SVGProps } from "react";
+import { Ref, forwardRef } from "react";
+const SvgPopUp = (props: SVGProps<SVGSVGElement>, ref: Ref<SVGSVGElement>) => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" ref={ref} {...props}><path d="M13 14h5V8h-5zm-9 6q-.824 0-1.412-.587A1.93 1.93 0 0 1 2 18V6q0-.824.587-1.412A1.93 1.93 0 0 1 4 4h16q.824 0 1.413.588Q22 5.175 22 6v12q0 .824-.587 1.413A1.93 1.93 0 0 1 20 20zm0-2h16V6H4z" /></svg>;
+const ForwardRef = forwardRef(SvgPopUp);
+export default ForwardRef;
\ No newline at end of file
diff --git a/packages/design-system-react/src/components/Icon/icons/SidePanel.tsx b/packages/design-system-react/src/components/Icon/icons/SidePanel.tsx
new file mode 100644
--- /dev/null
+++ b/packages/design-system-react/src/components/Icon/icons/SidePanel.tsx
@@ -1,0 +1,6 @@
+import * as React from "react";
+import type { SVGProps } from "react";
+import { Ref, forwardRef } from "react";
+const SvgSidePanel = (props: SVGProps<SVGSVGElement>, ref: Ref<SVGSVGElement>) => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" ref={ref} {...props}><path d="M5 21q-.824 0-1.412-.587A1.93 1.93 0 0 1 3 19V5q0-.824.587-1.412A1.93 1.93 0 0 1 5 3h14q.824 0 1.413.587Q21 4.176 21 5v14q0 .824-.587 1.413A1.93 1.93 0 0 1 19 21zm11-2h3V5h-3zm-2 0V5H5v14z" /></svg>;
+const ForwardRef = forwardRef(SvgSidePanel);
+export default ForwardRef;
\ No newline at end of file
diff --git a/packages/design-system-react/src/components/Icon/icons/index.ts b/packages/design-system-react/src/components/Icon/icons/index.ts
--- a/packages/design-system-react/src/components/Icon/icons/index.ts
+++ b/packages/design-system-react/src/components/Icon/icons/index.ts
@@ -178,6 +178,7 @@
import Plug from './Plug';
import PlusAndMinus from './PlusAndMinus';
import PolicyAlert from './PolicyAlert';
+import PopUp from './PopUp';
import Print from './Print';
import PriorityHigh from './PriorityHigh';
import PrivacyTip from './PrivacyTip';
@@ -218,6 +219,7 @@
import ShieldLock from './ShieldLock';
import ShoppingBag from './ShoppingBag';
import ShoppingCart from './ShoppingCart';
+import SidePanel from './SidePanel';
import SignalCellular from './SignalCellular';
import Slash from './Slash';
import Sms from './Sms';
@@ -459,6 +461,7 @@
Plug,
PlusAndMinus,
PolicyAlert,
+ PopUp,
Print,
PriorityHigh,
PrivacyTip,
@@ -499,6 +502,7 @@
ShieldLock,
ShoppingBag,
ShoppingCart,
+ SidePanel,
SignalCellular,
Slash,
Sms,
diff --git a/packages/design-system-react/src/types/index.ts b/packages/design-system-react/src/types/index.ts
--- a/packages/design-system-react/src/types/index.ts
+++ b/packages/design-system-react/src/types/index.ts
@@ -557,6 +557,7 @@
Plug = 'Plug',
PlusAndMinus = 'PlusAndMinus',
PolicyAlert = 'PolicyAlert',
+ PopUp = 'PopUp',
Print = 'Print',
PriorityHigh = 'PriorityHigh',
PrivacyTip = 'PrivacyTip',
@@ -597,6 +598,7 @@
ShieldLock = 'ShieldLock',
ShoppingBag = 'ShoppingBag',
ShoppingCart = 'ShoppingCart',
+ SidePanel = 'SidePanel',
SignalCellular = 'SignalCellular',
Slash = 'Slash',
Sms = 'Sms',You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit b4e7402. Configure here.
📖 Storybook Preview |
📖 Storybook Preview |
kirillzyusko
left a comment
There was a problem hiding this comment.
Awesome work! The idea with centralization is really amazing!
In future we may re-work internals of Icon component and move rendering to font-based approach - it'll improve performance of rendering on both web/mobile 🚀
We may want to use solutions like react-native-nano-icons or create our own font file with icons (I can help with this if needed!) for font-based rendering, but we can discuss it later!
📖 Storybook Preview |
## **Description** Removes the redundant SVG icon assets that were left behind in `packages/design-system-react/src/components/Icon/assets/` after the icon asset source-of-truth was centralized in #1084. This follow-up keeps `design-system-react` aligned with the phase 1 icon asset migration by deleting the unused duplicate files that are no longer referenced by the React package. ## **Related issues** Fixes: Follow-up to #1084 Part of #1042 ## **Manual testing steps** 1. Check out this branch and run `git diff main...HEAD -- packages/design-system-react/src/components/Icon/assets`. 2. Confirm the diff only deletes redundant SVG files from `packages/design-system-react/src/components/Icon/assets/`. 3. Optionally run `yarn workspace @metamask/design-system-react run generate-icons` and confirm icon generation still uses the shared assets source introduced in #1084. ## **Screenshots/Recordings** ### **Before** `packages/design-system-react/src/components/Icon/assets/` still contained duplicate SVG source files after #1084. ### **After** The redundant `design-system-react` icon asset copies are removed, leaving the shared asset source introduced in #1084 as the source of truth. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) - [x] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. Validation run locally: - `git push -u origin remove-redundant-icon-assets` completed successfully and ran the repo formatting/dedup hooks. - I did not run package tests or builds locally for this follow-up cleanup. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/bugbot) is generating a summary for commit 390c3c4. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…1084) ## **Description** Moves the single source of truth for all icon SVG assets into `packages/design-system-shared/src/assets/icons/`. Previously each platform package maintained its own copy of the ~279 SVG files. This is the first of four phases working toward fully centralizing Icon types and assets per ADR-0003/ADR-0004 (tracked in #1042). **What changed:** - Added `packages/design-system-shared/src/assets/icons/` with 279 SVGs copied from the React Native package - Updated `design-system-react-native/scripts/generate-icons.ts` to read SVGs from the shared source, apply `black→currentColor` processing, then copy to the local RN `assets/` folder (output is unchanged) - Updated `design-system-react/package.json` `generate-icons` script to point `svgr` at the shared assets folder instead of its own local `assets/` folder No public API changes. Both platform packages continue to ship the same generated files as before. ## **Related issues** Fixes: Part of #1042 (phase 1 of 4) ## **Manual testing steps** 1. Check out branch and run `yarn install` from repo root 2. Run `yarn workspace @metamask/design-system-react-native run generate-icons` — confirm `Icon.assets.ts` and `assets/*.svg` in the RN package are unchanged 3. Run `yarn workspace @metamask/design-system-react run generate-icons` — confirm the `icons/*.tsx` components and `icons/index.ts` in the React package are unchanged 4. Run `yarn build` — confirm all packages build without errors 5. Run `yarn test` — confirm all tests pass ## **Screenshots/Recordings** ### **Before** SVGs duplicated in two locations: - `packages/design-system-react-native/src/components/Icon/assets/` (source) - `packages/design-system-react/src/components/Icon/assets/` (source) ### **After** Single source of truth: - `packages/design-system-shared/src/assets/icons/` (source) - Platform `assets/` folders remain as generated output ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) - [x] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes icon generation inputs for both React and React Native to pull from a new shared SVG directory; risk is mainly build-time/regeneration mismatches or missing assets affecting downstream icon bundles. > > **Overview** > Moves the *source of truth* for icon SVGs into `design-system-shared` by adding a shared `src/assets/icons` directory and updating platform builds to consume it. > > React Native’s `generate-icons.ts` now reads SVGs from the shared directory, normalizes `black` to `currentColor`, and writes the processed files into the local RN `Icon/assets` folder before regenerating `Icon.assets.ts`/`IconName`. React’s `generate-icons` script is updated to point `svgr` at the shared icons path. > > Also adds new `PopUp` and `SidePanel` icons, wiring them into RN `Icon.assets.ts` and `IconName`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c95b4ef. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Removes the redundant SVG icon assets that were left behind in `packages/design-system-react/src/components/Icon/assets/` after the icon asset source-of-truth was centralized in #1084. This follow-up keeps `design-system-react` aligned with the phase 1 icon asset migration by deleting the unused duplicate files that are no longer referenced by the React package. ## **Related issues** Fixes: Follow-up to #1084 Part of #1042 ## **Manual testing steps** 1. Check out this branch and run `git diff main...HEAD -- packages/design-system-react/src/components/Icon/assets`. 2. Confirm the diff only deletes redundant SVG files from `packages/design-system-react/src/components/Icon/assets/`. 3. Optionally run `yarn workspace @metamask/design-system-react run generate-icons` and confirm icon generation still uses the shared assets source introduced in #1084. ## **Screenshots/Recordings** ### **Before** `packages/design-system-react/src/components/Icon/assets/` still contained duplicate SVG source files after #1084. ### **After** The redundant `design-system-react` icon asset copies are removed, leaving the shared asset source introduced in #1084 as the source of truth. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) - [x] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. Validation run locally: - `git push -u origin remove-redundant-icon-assets` completed successfully and ran the repo formatting/dedup hooks. - I did not run package tests or builds locally for this follow-up cleanup. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/bugbot) is generating a summary for commit 390c3c4. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…1084) ## **Description** Moves the single source of truth for all icon SVG assets into `packages/design-system-shared/src/assets/icons/`. Previously each platform package maintained its own copy of the ~279 SVG files. This is the first of four phases working toward fully centralizing Icon types and assets per ADR-0003/ADR-0004 (tracked in #1042). **What changed:** - Added `packages/design-system-shared/src/assets/icons/` with 279 SVGs copied from the React Native package - Updated `design-system-react-native/scripts/generate-icons.ts` to read SVGs from the shared source, apply `black→currentColor` processing, then copy to the local RN `assets/` folder (output is unchanged) - Updated `design-system-react/package.json` `generate-icons` script to point `svgr` at the shared assets folder instead of its own local `assets/` folder No public API changes. Both platform packages continue to ship the same generated files as before. ## **Related issues** Fixes: Part of #1042 (phase 1 of 4) ## **Manual testing steps** 1. Check out branch and run `yarn install` from repo root 2. Run `yarn workspace @metamask/design-system-react-native run generate-icons` — confirm `Icon.assets.ts` and `assets/*.svg` in the RN package are unchanged 3. Run `yarn workspace @metamask/design-system-react run generate-icons` — confirm the `icons/*.tsx` components and `icons/index.ts` in the React package are unchanged 4. Run `yarn build` — confirm all packages build without errors 5. Run `yarn test` — confirm all tests pass ## **Screenshots/Recordings** ### **Before** SVGs duplicated in two locations: - `packages/design-system-react-native/src/components/Icon/assets/` (source) - `packages/design-system-react/src/components/Icon/assets/` (source) ### **After** Single source of truth: - `packages/design-system-shared/src/assets/icons/` (source) - Platform `assets/` folders remain as generated output ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) - [x] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes icon generation inputs for both React and React Native to pull from a new shared SVG directory; risk is mainly build-time/regeneration mismatches or missing assets affecting downstream icon bundles. > > **Overview** > Moves the *source of truth* for icon SVGs into `design-system-shared` by adding a shared `src/assets/icons` directory and updating platform builds to consume it. > > React Native’s `generate-icons.ts` now reads SVGs from the shared directory, normalizes `black` to `currentColor`, and writes the processed files into the local RN `Icon/assets` folder before regenerating `Icon.assets.ts`/`IconName`. React’s `generate-icons` script is updated to point `svgr` at the shared icons path. > > Also adds new `PopUp` and `SidePanel` icons, wiring them into RN `Icon.assets.ts` and `IconName`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c95b4ef. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Removes the redundant SVG icon assets that were left behind in `packages/design-system-react/src/components/Icon/assets/` after the icon asset source-of-truth was centralized in #1084. This follow-up keeps `design-system-react` aligned with the phase 1 icon asset migration by deleting the unused duplicate files that are no longer referenced by the React package. ## **Related issues** Fixes: Follow-up to #1084 Part of #1042 ## **Manual testing steps** 1. Check out this branch and run `git diff main...HEAD -- packages/design-system-react/src/components/Icon/assets`. 2. Confirm the diff only deletes redundant SVG files from `packages/design-system-react/src/components/Icon/assets/`. 3. Optionally run `yarn workspace @metamask/design-system-react run generate-icons` and confirm icon generation still uses the shared assets source introduced in #1084. ## **Screenshots/Recordings** ### **Before** `packages/design-system-react/src/components/Icon/assets/` still contained duplicate SVG source files after #1084. ### **After** The redundant `design-system-react` icon asset copies are removed, leaving the shared asset source introduced in #1084 as the source of truth. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) - [x] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. Validation run locally: - `git push -u origin remove-redundant-icon-assets` completed successfully and ran the repo formatting/dedup hooks. - I did not run package tests or builds locally for this follow-up cleanup. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/bugbot) is generating a summary for commit 390c3c4. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Description
Moves the single source of truth for all icon SVG assets into
packages/design-system-shared/src/assets/icons/.Previously each platform package maintained its own copy of the ~279 SVG files. This is the first of four phases working toward fully centralizing Icon types and assets per ADR-0003/ADR-0004 (tracked in #1042).
What changed:
packages/design-system-shared/src/assets/icons/with 279 SVGs copied from the React Native packagedesign-system-react-native/scripts/generate-icons.tsto read SVGs from the shared source, applyblack→currentColorprocessing, then copy to the local RNassets/folder (output is unchanged)design-system-react/package.jsongenerate-iconsscript to pointsvgrat the shared assets folder instead of its own localassets/folderNo public API changes. Both platform packages continue to ship the same generated files as before.
Related issues
Fixes:
Part of #1042 (phase 1 of 4)
Manual testing steps
yarn installfrom repo rootyarn workspace @metamask/design-system-react-native run generate-icons— confirmIcon.assets.tsandassets/*.svgin the RN package are unchangedyarn workspace @metamask/design-system-react run generate-icons— confirm theicons/*.tsxcomponents andicons/index.tsin the React package are unchangedyarn build— confirm all packages build without errorsyarn test— confirm all tests passScreenshots/Recordings
Before
SVGs duplicated in two locations:
packages/design-system-react-native/src/components/Icon/assets/(source)packages/design-system-react/src/components/Icon/assets/(source)After
Single source of truth:
packages/design-system-shared/src/assets/icons/(source)assets/folders remain as generated outputPre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes the icon generation pipeline and import paths for two packages and adds a large set of shared assets, so misconfigured paths or subtle SVG processing differences could break builds or produce missing/incorrect icons.
Overview
Centralizes the SVG icon set by adding
packages/design-system-shared/src/assets/iconsas the new source-of-truth for icon assets.Updates
design-system-react-native/scripts/generate-icons.tsto read SVGs from the shared folder, normalizeblacktocurrentColor, and copy the processed files into the RN package’s localIcon/assetsoutput before regeneratingIcon.assets.tsandIconNametypes. Updates@metamask/design-system-react’sgenerate-iconsscript to runsvgragainst the shared icons path instead of a local assets folder.Regenerates RN outputs to include new icons (
PopUp,SidePanel) inIcon.assets.ts, adds the corresponding SVGs under RNassets/, and extends theIconNameenum accordingly.Reviewed by Cursor Bugbot for commit e509297. Bugbot is set up for automated code reviews on this repo. Configure here.