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

[Feature] Text component #591

Merged
merged 24 commits into from
Nov 15, 2024
Merged

[Feature] Text component #591

merged 24 commits into from
Nov 15, 2024

Conversation

narin
Copy link
Contributor

@narin narin commented Nov 11, 2024

Description of Change

Implementation of a new Text component that displays text based on our typography tokens

  • Supports the following variants: body, heading, display, and navigation
  • Allows for different size props for body and heading: xs, sm, md, lg
  • Defaults to body medium if no variant or size is provided
  • Has bottomSpacing prop that accepts different spacing tokens when something other than the default paragraph spacing is desired
  • Includes a11y override and color override

Testing Packages

  • components 0.27.1-alpha.0

Screenshots/Video

Web
Screen.Recording.2024-11-12.at.10.00.50.AM.mov
iOS
ScreenRecording_11-12-2024.10-17-18_1.MP4
Android
screen-20241112-103102.mp4
iOS Voiceover
ScreenRecording_11-12-2024.10-32-02_1.MP4
Android Talkback
screen-20241112-103427.mp4
In-app test

Simulator Screenshot - iPhone 16 - 2024-11-12 at 11 14 34

Testing

  • Tested on iOS
  • Tested on Android
  • Tested on Web

PR Checklist

Code reviewer validation:

  • General
    • PR is linked to ticket(s)
    • PR has changelog label applied if it's to be included in the changelog
    • Acceptance criteria:
      • All satisfied or
      • Documented reason for not being performed or
      • Split to separate ticket and ticket is linked by relevant AC(s)
    • Above PR sections adequately filled out
    • If any breaking changes, in accordance with the pre-1.0.0 versioning guidelines: a CU ticket has been created for the VA Mobile App detailing necessary adjustments with the package version that will be published by this ticket
  • Code
    • Tests are included if appropriate (or split to separate ticket)
    • New functions have proper TSDoc annotations

Publish

If changes warrant a new version per the versioning guidelines and the PR is approved and ready to merge:

@narin narin changed the title Feature/548 narin text component [Feature] Text component Nov 12, 2024
@narin narin marked this pull request as ready for review November 12, 2024 19:20
@narin narin requested a review from a team as a code owner November 12, 2024 19:20
Copy link
Contributor

@TimRoe TimRoe left a comment

Choose a reason for hiding this comment

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

Dropping a preemptive request changes to fix the 5 linting issues in the PR that are causing linting checks to fail.

@narin narin requested a review from TimRoe November 13, 2024 17:34
* Convenience function that accepts a spacing size abbreviation and returns the corresponding
* spacing token
*/
export function getSpacingToken(size: SpacerSize): number {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't feel strongly that anything be changed, but raising the question of if this should be in utils somewhere instead of the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a new utils/tokens.ts file and added to the utils index export. Moved this function there.

}

const style: TextStyle = {
...typography[typographyKey as keyof typeof typography],
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be simplified typing typographyKey at instantiation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving it to the instantiation causes some TS complaints with the template literals. I was able to remove it for the sizeMap key though.

Copy link
Contributor

@TimRoe TimRoe left a comment

Choose a reason for hiding this comment

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

Mostly good to go, requesting changes primarily to clean up the doc around navigation which no longer exists in the component.

Also had some other comments/suggestions, but none that explicitly need changing.

Edit: Also watching the rest of the PR videos, not sure if the iOS one was just in progress, but if it's reading the "body" blocks as "heading" it doesn't seem like it should be and should be updated--code-wise, it looks like it should be fine though.

@narin narin requested a review from TimRoe November 14, 2024 21:28
@narin narin merged commit b10ed2e into main Nov 15, 2024
4 of 5 checks passed
@narin narin deleted the feature/548-narin-text-component branch November 15, 2024 04:25
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.

3 participants