-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add ButtonHero component to design system react #843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📖 Storybook Preview |
📖 Storybook Preview |
📖 Storybook Preview |
| </ButtonHero> | ||
| ), | ||
| }, | ||
| ); |
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| className={mergedClassName} | ||
| isDisabled={isDisabled} | ||
| isLoading={isLoading} | ||
| data-theme="light" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locked to light theme
| import type { ButtonBaseProps } from '../ButtonBase'; | ||
|
|
||
| export type ButtonHeroProps = ButtonBaseProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extends button base type
| export { ButtonHero } from './ButtonHero'; | ||
| export type { ButtonHeroProps } from './ButtonHero.types'; | ||
| export { ButtonHeroSize } from '../../types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exporting component and props
| export { ButtonHero, ButtonHeroSize } from './ButtonHero'; | ||
| export type { ButtonHeroProps } from './ButtonHero'; |
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding comphrehensive docs
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| export { ButtonBaseSize as ButtonPrimarySize }; | ||
| export { ButtonBaseSize as ButtonSecondarySize }; | ||
| export { ButtonBaseSize as ButtonTertiarySize }; | ||
| export { ButtonBaseSize as ButtonHeroSize }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exporting ButtonSize as ButtonHeroSize
📖 Storybook Preview |
0a87210 to
455ef16
Compare
| "@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", |
There was a problem hiding this comment.
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
📖 Storybook Preview |
There was a problem hiding this 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
ButtonHerocomponent with full documentation, stories, tests, and Figma integration - Size alias
ButtonHeroSizeexported for type consistency across button variants - Added
@testing-library/user-eventdev 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.
packages/design-system-react/src/components/ButtonHero/README.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
📖 Storybook Preview |
📖 Storybook Preview |
📖 Storybook Preview |
## **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 -->


Description
Implements a new ButtonHero component for @metamask/design-system-react
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-182
Manual testing steps
yarn storybookScreenshots/Recordings
Before
No ButtonHero component existed in the React design system.
After
ButtonHero component now available
after.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Introduces
ButtonHerocomponent with Storybook docs, Figma Code Connect, tests, exports, and size type alias; adds@testing-library/user-eventdevDependency.ButtonHerobuilt onButtonBasewith light theme styling, interactive/disabled/loading states, and ref forwarding (ButtonHero.tsx).components/index.tsandcomponents/ButtonHero/index.ts.ButtonHero.stories.tsxandREADME.mdxwith controls and examples.ButtonHero.figma.tsx).ButtonHeroSizeas alias ofButtonBaseSizeinsrc/types/index.ts.ButtonHero.test.tsxcovering rendering, interaction, states, and ref.@testing-library/user-eventtodevDependencies.Written by Cursor Bugbot for commit 1a07daa. This will update automatically on new commits. Configure here.