Commit 2de6091
authored
refactor(Predict): migrate Text component to design system (MetaMask#23344)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
- Replace Text imports from component-library with
@metamask/design-system-react-native
- Update Text variant names to match design system conventions:
- HeadingMD → HeadingMd, HeadingSM → HeadingSm
- BodyMDMedium → BodyMd, BodyLGMedium → BodyLg
- BodySM → BodySm, BodySMMedium → BodySm
- BodyXS → BodyXs
- Update TextColor enum values to design system tokens:
- Default → TextDefault
- Alternative → TextAlternative
- Success → SuccessDefault
- Error → ErrorDefault
- Muted → TextMuted
- Inverse → PrimaryInverse
- Add twClassName='font-medium' to Text components that previously used
Medium variants (BodyMDMedium, BodyLGMedium, BodySMMedium) to preserve
font weight
- Remove unused fontStyles import in PredictSellPreview.styles.ts
- Replace fontStyles.bold with fontWeight: 'bold'
Affected components:
- PredictMarketOutcome
- PredictSellPreview
- PredictBuyPreview
- PredictMarketDetails
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes:
https://consensyssoftware.atlassian.net/browse/PRED-310?atlOrigin=eyJpIjoiOTE5YjJjNmRjOTAzNDU3N2EwZTQwNDcwMjJhMmViZGIiLCJwIjoiaiJ9
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] 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](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.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]
> Replaces legacy Text usage with @metamask/design-system-react-native
across Predict screens, updating variants/colors and preserving weights,
plus minor style cleanup.
>
> - **UI/Design System Migration**
> - Replace `component-library` `Text` with
`@metamask/design-system-react-native` `Text` across Predict screens.
> - Update typography variants (e.g., `HeadingMD/SM` → `HeadingMd/Sm`,
`Body*Medium` → `Body*` + `font-medium`, `BodyXS/SM/MD/LG` →
`BodyXs/Sm/Md/Lg`).
> - Map color tokens to design system equivalents (`Default` →
`TextDefault`, `Alternative` → `TextAlternative`, `Success` →
`SuccessDefault`, `Error` → `ErrorDefault`, `Muted` → `TextMuted`,
`Inverse` → `PrimaryInverse`).
> - **Components Updated**
> - `PredictMarketOutcome`: Heading/body/text colors and
winner/loser/price labels updated to new tokens and variants.
> - `PredictBuyPreview`: Header, balance, errors, "to win", CTA labels,
and disclaimers migrated to new variants/colors.
> - `PredictMarketDetails`: Header title, tabs, status/messages, about
section, resolved/outcomes chips, footnote text migrated to new
variants/colors.
> - `PredictSellPreview`: Header, cash-out values/PnL, info text, CTA,
footnote migrated to new variants/colors.
> - **Styles Cleanup**
> - `PredictSellPreview.styles.ts`: remove `fontStyles` import and use
`fontWeight: 'bold'`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3b752a3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 537aca3 commit 2de6091
5 files changed
Lines changed: 163 additions & 93 deletions
File tree
- app/components/UI/Predict
- components/PredictMarketOutcome
- views
- PredictBuyPreview
- PredictMarketDetails
- PredictSellPreview
Lines changed: 18 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
134 | | - | |
135 | | - | |
| 133 | + | |
| 134 | + | |
136 | 135 | | |
137 | 136 | | |
138 | 137 | | |
139 | 138 | | |
140 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
152 | | - | |
| 154 | + | |
| 155 | + | |
153 | 156 | | |
154 | 157 | | |
155 | | - | |
156 | | - | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
169 | | - | |
170 | | - | |
| 172 | + | |
| 173 | + | |
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
177 | 180 | | |
178 | | - | |
| 181 | + | |
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
| |||
192 | 195 | | |
193 | 196 | | |
194 | 197 | | |
195 | | - | |
| 198 | + | |
196 | 199 | | |
197 | 200 | | |
198 | 201 | | |
| |||
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
212 | | - | |
| 215 | + | |
213 | 216 | | |
214 | 217 | | |
215 | 218 | | |
| |||
Lines changed: 46 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
288 | 287 | | |
289 | 288 | | |
290 | 289 | | |
291 | | - | |
| 290 | + | |
292 | 291 | | |
293 | 292 | | |
294 | 293 | | |
| |||
302 | 301 | | |
303 | 302 | | |
304 | 303 | | |
305 | | - | |
306 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
321 | | - | |
| 322 | + | |
| 323 | + | |
322 | 324 | | |
323 | 325 | | |
324 | | - | |
325 | | - | |
| 326 | + | |
| 327 | + | |
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
| |||
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
364 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
365 | 370 | | |
366 | 371 | | |
367 | 372 | | |
| |||
373 | 378 | | |
374 | 379 | | |
375 | 380 | | |
376 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
377 | 386 | | |
378 | 387 | | |
379 | 388 | | |
380 | 389 | | |
381 | 390 | | |
382 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
383 | 396 | | |
384 | 397 | | |
385 | 398 | | |
| |||
398 | 411 | | |
399 | 412 | | |
400 | 413 | | |
401 | | - | |
402 | | - | |
| 414 | + | |
| 415 | + | |
403 | 416 | | |
404 | 417 | | |
405 | 418 | | |
| |||
417 | 430 | | |
418 | 431 | | |
419 | 432 | | |
420 | | - | |
421 | | - | |
| 433 | + | |
| 434 | + | |
422 | 435 | | |
423 | 436 | | |
424 | 437 | | |
| |||
455 | 468 | | |
456 | 469 | | |
457 | 470 | | |
458 | | - | |
459 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
460 | 474 | | |
461 | 475 | | |
462 | 476 | | |
| |||
481 | 495 | | |
482 | 496 | | |
483 | 497 | | |
484 | | - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
485 | 502 | | |
486 | 503 | | |
487 | 504 | | |
| |||
502 | 519 | | |
503 | 520 | | |
504 | 521 | | |
505 | | - | |
506 | | - | |
| 522 | + | |
| 523 | + | |
507 | 524 | | |
508 | 525 | | |
509 | 526 | | |
510 | 527 | | |
511 | 528 | | |
512 | 529 | | |
513 | 530 | | |
514 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
515 | 535 | | |
516 | 536 | | |
517 | 537 | | |
518 | | - | |
| 538 | + | |
519 | 539 | | |
520 | 540 | | |
521 | 541 | | |
| |||
0 commit comments