Skip to content

[DSRN] Add BadgeIcon#473

Merged
brianacnguyen merged 10 commits intomainfrom
dsrn/badge-icon
Mar 21, 2025
Merged

[DSRN] Add BadgeIcon#473
brianacnguyen merged 10 commits intomainfrom
dsrn/badge-icon

Conversation

@brianacnguyen
Copy link
Copy Markdown
Contributor

@brianacnguyen brianacnguyen commented Mar 11, 2025

Description

This PR adds the BadgeIcon component to the @metamask/design-system-react-native package

Related issues

Fixes: #401

Manual testing steps

  1. Run yarn storybook:ios from root
  2. Go to Components > BadgeIcon

Screenshots/Recordings

Before

After

Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2025-03-21.at.14.38.15.mp4

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.

@brianacnguyen brianacnguyen self-assigned this Mar 11, 2025
@brianacnguyen brianacnguyen requested a review from a team as a code owner March 11, 2025 04:25
Copy link
Copy Markdown
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

Component and stories look great, but we have some inconsistencies between Figma and Code. Do we need a variant prop? It might make sense to remove it and rely solely on the iconName prop.

Thread in Figma

  • Checked alignment with Figma design ❌
  • Checked Storybook stories and controls ✅

Comment thread packages/design-system-react-native/src/components/BadgeIcon/BadgeIcon.test.tsx Outdated
…adgeIcon.test.tsx

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
@brianacnguyen
Copy link
Copy Markdown
Contributor Author

Component and stories look great, but we have some inconsistencies between Figma and Code. Do we need a variant prop? It might make sense to remove it and rely solely on the iconName prop.

Thread in Figma

  • Checked alignment with Figma design ❌
  • Checked Storybook stories and controls ✅

The variant prop was based on what was agreed with the Insights Report

Copy link
Copy Markdown
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 adds a new BadgeIcon component to the design system for React Native to visually indicate different actions or statuses. In addition to the new component, the PR includes its stories, tests, documentation, and necessary updates to types, constants, and assets.

  • Introduces the BadgeIcon component with customizable variants and icon mapping.
  • Adds storybook stories and tests to verify component behavior.
  • Updates package exports, documentation, and the Icon assets/types to support the new Plant icon for the Stake variant.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/design-system-react-native/src/components/BadgeIcon/BadgeIcon.tsx New BadgeIcon component implementation
packages/design-system-react-native/src/components/BadgeIcon/BadgeIcon.stories.tsx Storybook story for BadgeIcon
packages/design-system-react-native/src/components/BadgeIcon/BadgeIcon.test.tsx Test coverage for BadgeIcon
packages/design-system-react-native/src/components/BadgeIcon/README.md Documentation for BadgeIcon
packages/design-system-react-native/src/components/BadgeIcon/BadgeIcon.types.ts Type declarations for BadgeIcon
packages/design-system-react-native/src/components/BadgeIcon/BadgeIcon.constants.ts Constants and icon mapping for BadgeIcon
packages/design-system-react-native/src/components/BadgeIcon/index.ts Export for BadgeIcon via index
packages/design-system-react-native/src/index.ts Updated package exports to include BadgeIcon
packages/design-system-react-native/src/components/Icon/Icon.types.ts Updated Icon types with the new Plant icon
packages/design-system-react-native/src/components/Icon/Icon.assets.ts Added Plant asset and removed the Stake asset
packages/design-system-react-native/src/components/AvatarIcon/AvatarIcon.tsx Updated Icon import in AvatarIcon
apps/storybook-react-native/.storybook/storybook.requires.js Added BadgeIcon stories to Storybook

};
const { getByTestId } = render(<TestComponent />);
const badgeIcon = getByTestId('badge-icon');
expect(badgeIcon.props.style).toEqual(customStyle);
Copy link

Copilot AI Mar 21, 2025

Choose a reason for hiding this comment

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

The test expects the style prop to equal customStyle, but the component combines a computed tw style with the custom style in an array. Consider updating the test to check that the custom style is included or modify the component to flatten the styles.

Suggested change
expect(badgeIcon.props.style).toEqual(customStyle);
expect(badgeIcon.props.style).toEqual(expect.arrayContaining([customStyle]));

Copilot uses AI. Check for mistakes.
@brianacnguyen brianacnguyen merged commit b9467ea into main Mar 21, 2025
36 checks passed
@brianacnguyen brianacnguyen deleted the dsrn/badge-icon branch March 21, 2025 21:48
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.

[React Native]: Create BadgeIcon component in shared UI component library

3 participants