Skip to content

refactor(ramp): migrate Ramp UI primitives to design system (phase 1)#28048

Merged
wachunei merged 7 commits into
mainfrom
refactor/money-mvmt-ds-migration-1
Mar 30, 2026
Merged

refactor(ramp): migrate Ramp UI primitives to design system (phase 1)#28048
wachunei merged 7 commits into
mainfrom
refactor/money-mvmt-ds-migration-1

Conversation

@wachunei

@wachunei wachunei commented Mar 27, 2026

Copy link
Copy Markdown
Member

Description

This PR migrates Ramp Buy UI under app/components/UI/Ramp/Views/ and app/components/UI/Ramp/components/ (excluding Deposit/Aggregator-only flows where noted) from app/component-library primitives to @metamask/design-system-react-native for Text, Icon, Button, and related enums (TextVariant, TextColor, IconColor, FontWeight, ButtonVariant, etc.).

Motivation: Align Ramp with the MetaMask mobile design system for consistent typography, icons, and buttons.

Scope notes:

  • Deferred (follow-up): Bottom sheets, Toast wiring, composite list rows (avatars/badges), and some BannerAlert usages remain on component-library where a full migration would require larger sheet/toast work.
  • Cross-touch: Minimal updates in Deposit ConfigurationModal, TokenSelectorModal, and Aggregator SettingsModal for shared types (e.g. IconName/IconColor for toasts and MenuItem).
  • BuildQuote amount: Hero amount uses the same dynamic font scaling pattern as PredictAmountDisplay (getFontSizeForInputLength, lineHeight = fontSize + 10, tracking-tight) with regular weight for a lighter display.

Changelog

CHANGELOG entry: Updated Ramp on-ramp screens to use the MetaMask design system for typography, icons, and primary actions.

Related issues

Fixes:

Manual testing steps

Feature: Ramp buy flow design system migration

  Scenario: Build quote amount displays and keypad still work
    Given the user opens Buy and reaches the amount (Build Quote) screen
    When they enter an amount using the keypad and optional quick amounts
    Then the amount displays with readable typography and quotes continue to load as before

  Scenario: Settings and payment flows still open
    Given the user is on the Build Quote screen
    When they open settings or payment selection where migrated components are used
    Then screens render without crashes and primary actions match expected behavior

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

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.

Note

Medium Risk
Medium risk because it broadly changes rendering primitives (Text/Icon/Button), style tokens, and toast/icon enums across critical Ramp flows, which can introduce UI regressions even if logic is mostly unchanged.

Overview
Updates Ramp Buy/Deposit UI to use @metamask/design-system-react-native primitives and tokens for Text, Icon, Button, and related enums, including updating tests/mocks/snapshots to match the new render output.

Refines the BuildQuote hero amount display by introducing getFontSizeForInputLength-based dynamic sizing (and cursor sizing) instead of adjustsFontSizeToFit, and switches some color/variant mappings to design-system equivalents while keeping Toast icon color enums on the component-library where required.

Written by Cursor Bugbot for commit fd362d7. This will update automatically on new commits. Configure here.

- Use @metamask/design-system-react-native for Text, Icon, Button in Ramp Views/components
- Align BuildQuote hero amount with Predict-style scaling and regular weight
- Split toast IconName vs DS IconName where needed; update ConfigurationModal tests
- Refresh Jest snapshots for migrated components
- Fix QuoteDisplay.test DS mock to satisfy ESLint (no require imports)
@wachunei wachunei self-assigned this Mar 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-money-movement issues related to Money Movement features label Mar 27, 2026
@wachunei

Copy link
Copy Markdown
Member Author

cursor review

Comment thread app/components/UI/Ramp/Views/Modals/SettingsModal/SettingsModal.tsx Outdated
- Use component-library IconColor for showToast (Toast still uses CL Icon)
- QuoteDisplay.test: jest.mock factories use requireActual + createElement only
- Move getFontSizeForInputLength to dedicated module with branch tests
@wachunei wachunei marked this pull request as ready for review March 27, 2026 16:42
@wachunei wachunei requested a review from a team as a code owner March 27, 2026 16:42
@github-actions github-actions Bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 27, 2026
imageSource={networkImageSource}
name={displayName}
size={AvatarSize.Xs}
style={styles.selectedNetworkIcon}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

double spacing here, will push a fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in dcaf84e — removed the redundant marginRight: 8 (selectedNetworkIcon style) from AvatarNetwork since Button's startAccessory gap already handles the spacing.

@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 27, 2026
/>
{currencySuffix ? (
<Text
variant={TextVariant.HeadingLG}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed adjustsFontSizeToFit without overflow protection for long amounts

Medium Severity

The adjustsFontSizeToFit prop was removed from the amount Text component but the replacement getFontSizeForInputLength only considers amountDisplayString.length (character count), not actual rendered width. The minimum font size floors at 12px for inputs longer than 18 characters, but with numberOfLines={1} and no adjustsFontSizeToFit, text exceeding the container width will be clipped rather than shrunk. Wide characters (e.g. "W") or certain currency symbols may overflow at lengths well under 18. The old adjustsFontSizeToFit handled this natively regardless of character width.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot do you think adding adjustsFontSizeToFit will work well along with getFontSizeForInputLength?

@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 27, 2026

@Akaryatrh Akaryatrh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

/>
{currencySuffix ? (
<Text
variant={TextVariant.HeadingLG}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Amount font size ignores suffix text element overflow

Medium Severity

The old code used a single Text element with adjustsFontSizeToFit which let React Native automatically shrink text to fit the container. The new code removes adjustsFontSizeToFit and splits the display into two separate Text elements (prefix+amount and suffix) inside a flexDirection: 'row' container. While getFontSizeForInputLength computes a size based on the full string length, numberOfLines={1} only applies to the first Text (prefix+amount) — the suffix Text has no overflow protection. For currencies with long suffixes or large amounts, the row can overflow horizontally since neither element can shrink to fit the available width.

Additional Locations (1)
Fix in Cursor Fix in Web

@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeRamps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 60 changed files are exclusively within app/components/UI/Ramp/ - this is a design system migration PR. The changes migrate Ramp/Deposit UI components from the old component-library (component-library/components/Texts/Text, component-library/components/Icons/Icon, component-library/components/Buttons/Button) to the new @metamask/design-system-react-native package.

Key changes include:

  1. Token renames: TextVariant.HeadingMD → HeadingMd, TextColor.Alternative → TextColor.TextAlternative, ButtonVariants.Primary → ButtonVariant.Primary, IconColor.Default → IconColor.IconDefault, etc.
  2. Button API changes: label prop → children pattern, width={ButtonWidthTypes.Full} → isFullWidth, loading → isLoading
  3. New getFontSizeForInputLength utility for dynamic font sizing in BuildQuote amount input
  4. Import source changes from component-library to @metamask/design-system-react-native

The scope is strictly limited to Ramp UI components (on-ramp, off-ramp, deposit flows). No changes to core wallet, Engine, controllers, navigation, confirmations, accounts, networks, or any shared components. SmokeRamps is the appropriate tag to validate these UI changes in the buy/sell/deposit flows.

No other tags are needed as the changes don't touch:

  • Confirmations (no transaction flow changes)
  • Accounts (no account management changes)
  • Network (no network changes)
  • Trade/Swap (no swap changes)
  • Any shared navigation or modal components

Performance Test Selection:
All changes are UI-only design system token migrations within the Ramp component directory. The getFontSizeForInputLength utility is a simple lookup function with no performance implications. No changes to data loading, state management, list rendering performance, or app initialization. No performance tests are warranted.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

Copy link
Copy Markdown

@wachunei wachunei added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit b67ef7f Mar 30, 2026
91 checks passed
@wachunei wachunei deleted the refactor/money-mvmt-ds-migration-1 branch March 30, 2026 18:54
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-L team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants