Skip to content

Conversation

@georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Oct 21, 2025

Description

Implements a new ButtonHero component for @metamask/design-system-react

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-182

Manual testing steps

  1. Start the React Storybook: yarn storybook
  2. Navigate to "React Components/ButtonHero" in the sidebar
  3. Read docs and check stories

Screenshots/Recordings

Before

No ButtonHero component existed in the React design system.

After

ButtonHero component now available

after.mov

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs
  • 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 format if applicable
  • I've applied the right labels on the PR (see labeling guidelines). 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.

Note

Introduces ButtonHero component with Storybook docs, Figma Code Connect, tests, exports, and size type alias; adds @testing-library/user-event devDependency.

  • Components:
    • Add ButtonHero built on ButtonBase with light theme styling, interactive/disabled/loading states, and ref forwarding (ButtonHero.tsx).
    • New exports in components/index.ts and components/ButtonHero/index.ts.
  • Docs/Storybook:
    • Add ButtonHero.stories.tsx and README.mdx with controls and examples.
    • Add Figma Code Connect mapping (ButtonHero.figma.tsx).
  • Types:
    • Export ButtonHeroSize as alias of ButtonBaseSize in src/types/index.ts.
  • Tests:
    • Add ButtonHero.test.tsx covering rendering, interaction, states, and ref.
  • Tooling:
    • Add @testing-library/user-event to devDependencies.

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

@georgewrmarshall georgewrmarshall self-assigned this Oct 21, 2025
@github-actions
Copy link
Contributor

📖 Storybook Preview

@georgewrmarshall georgewrmarshall changed the title feat: add ButtonHero component for React design system feat: add ButtonHero component to design system react Oct 21, 2025
@github-actions
Copy link
Contributor

📖 Storybook Preview

@github-actions
Copy link
Contributor

📖 Storybook Preview

</ButtonHero>
),
},
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding Figma Code Connect to allow for code generation in Figma

codeconnect.mov

@@ -0,0 +1,129 @@
import type { Meta, StoryObj } from '@storybook/react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding storybook stories and controls

@@ -0,0 +1,104 @@
import { render, screen } from '@testing-library/react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding comprehensive testing 100% coverage

Image

className={mergedClassName}
isDisabled={isDisabled}
isLoading={isLoading}
data-theme="light"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Locked to light theme

Comment on lines +1 to +3
import type { ButtonBaseProps } from '../ButtonBase';

export type ButtonHeroProps = ButtonBaseProps;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extends button base type

Comment on lines +1 to +3
export { ButtonHero } from './ButtonHero';
export type { ButtonHeroProps } from './ButtonHero.types';
export { ButtonHeroSize } from '../../types';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exporting component and props

Comment on lines +105 to +106
export { ButtonHero, ButtonHeroSize } from './ButtonHero';
export type { ButtonHeroProps } from './ButtonHero';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exporting from index

@@ -0,0 +1,253 @@
import { Controls, Canvas } from '@storybook/addon-docs/blocks';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding comphrehensive docs

Comment on lines 7 to 14
A branded, high-impact button reserved for the most important actions in Trade. Use sparingly for key user actions that require emphasis and visual prominence.

Use for:

- Swapping tokens
- Claiming winnings (e.g., Polymarket bets)
- Claiming rewards
Other critical, high-value actions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Description matches Figma

Image

export { ButtonBaseSize as ButtonPrimarySize };
export { ButtonBaseSize as ButtonSecondarySize };
export { ButtonBaseSize as ButtonTertiarySize };
export { ButtonBaseSize as ButtonHeroSize };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exporting ButtonSize as ButtonHeroSize

@github-actions
Copy link
Contributor

📖 Storybook Preview

"@svgr/cli": "^8.1.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.6.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use for click events surprising we haven't used it for any other components. Should addd it for ButtonBase. Will do in a separate PR

@github-actions
Copy link
Contributor

📖 Storybook Preview

@georgewrmarshall georgewrmarshall marked this pull request as ready for review October 22, 2025 01:37
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner October 22, 2025 01:37
cursor[bot]

This comment was marked as outdated.

amandaye0h
amandaye0h previously approved these changes Oct 22, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new ButtonHero component to the @metamask/design-system-react package, designed as a high-emphasis, branded button for critical user actions in Trade applications. The component is built on top of ButtonBase and enforces a light theme with primary color styling.

Key changes:

  • New ButtonHero component with full documentation, stories, tests, and Figma integration
  • Size alias ButtonHeroSize exported for type consistency across button variants
  • Added @testing-library/user-event dev dependency for improved interaction testing

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/types/index.ts Exports ButtonHeroSize as an alias of ButtonBaseSize
src/components/index.ts Barrel exports for ButtonHero, ButtonHeroSize, and ButtonHeroProps
src/components/ButtonHero/index.ts Re-exports component and types
src/components/ButtonHero/README.mdx Comprehensive documentation with usage examples and API reference
src/components/ButtonHero/ButtonHero.types.ts Type definition extending ButtonBaseProps
src/components/ButtonHero/ButtonHero.tsx Component implementation with light theme enforcement and interactive state handling
src/components/ButtonHero/ButtonHero.test.tsx Unit tests covering render, events, states, ref forwarding, and class merging
src/components/ButtonHero/ButtonHero.stories.tsx Storybook stories demonstrating component variants
src/components/ButtonHero/ButtonHero.figma.tsx Figma Code Connect integration
package.json Adds @testing-library/user-event dev dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Contributor

📖 Storybook Preview

@github-actions
Copy link
Contributor

📖 Storybook Preview

@github-actions
Copy link
Contributor

📖 Storybook Preview

@georgewrmarshall georgewrmarshall merged commit a575a14 into main Oct 22, 2025
42 checks passed
@georgewrmarshall georgewrmarshall deleted the feat/button-hero-dsr branch October 22, 2025 23:18
@georgewrmarshall georgewrmarshall mentioned this pull request Dec 9, 2025
7 tasks
brianacnguyen pushed a commit that referenced this pull request Dec 9, 2025
## **Description**

This PR releases version 17.0.0 of the MetaMask Design System, featuring
important fixes for mobile font compatibility, the addition of the
ButtonHero component to React, export fixes for React Native, and
various dependency updates including ESLint configuration upgrades.

## **Included PRs**

#836, #837, #838, #840, #843, #845, #846, #847, #848, #850, #851, #852,
#853, #854, #855, #856, #857, #858, #859, #861, #862, #863, #864

## **Manual testing steps**

1. Check package.json version bumps align with included changes
2. Check changelog accurately reflects the release

## **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
- [x] I've included tests if applicable
- [x] 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]
> Release 17.0.0 introducing React `ButtonHero`, RN font naming changes
and TWRNC preset font family rename (both breaking), plus RN export fix
and dependency updates.
> 
> - **Release 17.0.0**
>   - Bump root `package.json` to `17.0.0`.
> - **React (`@metamask/[email protected]`)**
>   - Add `ButtonHero` component for prominent CTAs.
>   - Update `@metamask/utils` peer to `^11.8.1`.
> - **React Native (`@metamask/[email protected]`)**
> - BREAKING: Rename font files to hyphenated PostScript format for iOS
Metro compatibility.
>   - Export missing `TextButtonSize` enum.
> - Peer: require `@metamask/design-system-twrnc-preset@^0.3.0`; update
`@metamask/utils` peer.
> - **TWRNC preset (`@metamask/[email protected]`)**
> - BREAKING: Rename font family names to hyphenated PostScript format
for iOS/expo-font.
> - **Changelogs**
>   - Update `CHANGELOG.md` links and entries for all packages.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9a90311. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants