Skip to content
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

chore: spreading props in the text component for design system react #410

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Jan 31, 2025

Description

This PR adds support for spreading additional HTML attributes to the Text component, allowing for better component flexibility and testing capabilities. The changes include:

  1. Adding spread operator support in the Text component to pass through additional props
  2. Adding a test case to verify props are correctly applied to the underlying element
  3. Adding data-test id

Related issues

Fixes: N/A

Manual testing steps

  1. Import the Text component
  2. Verify that HTML attributes (like data-testid) can be passed and are applied correctly
  3. Verify existing functionality continues to work as expected

Screenshots/Recordings

N/A - Component behavior change only

Before

HTML attributes could not be passed through to the underlying element

After

HTML attributes can now be passed through and applied to the underlying element

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

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.

@georgewrmarshall georgewrmarshall self-assigned this Jan 31, 2025
@georgewrmarshall georgewrmarshall marked this pull request as ready for review January 31, 2025 00:12
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner January 31, 2025 00:12
Comment on lines +63 to +66
/**
* Optional prop for testing purposes
*/
'data-testid'?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm unfortunately this is still needed for this issue #409 (comment)

@georgewrmarshall georgewrmarshall merged commit 70aa157 into main Jan 31, 2025
30 checks passed
@georgewrmarshall georgewrmarshall deleted the fix/text-spread-props branch January 31, 2025 17:42
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.

2 participants