-
Notifications
You must be signed in to change notification settings - Fork 0
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] Update components to use typography tokens or Text component #612
[Feature] Update components to use typography tokens or Text component #612
Conversation
…ext styling - Replaced hardcoded font properties with typography tokens from mobile-tokens. - Simplified textStyle definition and ensured consistent link color handling based on variant. - Removed redundant code related to font settings and link color assignment.
…ext styling - Integrated typography tokens from mobile-tokens to enhance text styling consistency. - Updated textStyle to use typography.vadsFontBodyLarge for better maintainability. - Retained conditional fontFamily assignment for selected state while removing redundant font definitions.
… styling consistency - Replaced hardcoded font properties with typography tokens from mobile-tokens. - Updated text styles for Header, Hint, Error, Label, and Description components to use typography.vadsFontBodyLarge and typography.vadsFontBodySmall. - Renamed Text import to RNText for clarity and consistency across the component. - Removed redundant font definitions to streamline the codebase.
- Removed TODO comments in Button and SegmentedControl components to clean up the codebase. - Updated Link component to set marginBottom to 0
…ext-tokens-or-component
…al cleanup and refactoring: - Simplified getTextStyle function in Button component for cleaner code. - Removed unnecessary Spacer components in CheckboxGroup, RadioButton, and CheckboxRadio components to streamline layout. - Updated LoadingIndicator to remove unused imports and improve clarity. - Refactored FormText component to utilize typography tokens for consistent text styling across Header, Hint, Error, Label, and Description components. - Replaced hardcoded font properties with typography tokens and integrated the Text component for improved maintainability.
…or-component' of github.com:department-of-veterans-affairs/va-mobile-library into feature/542-narin-update-components-to-use-text-tokens-or-component
Should this also be linked to another ticket? Just linked to one for adding colors, not updating components to use Text. |
@@ -143,8 +128,9 @@ export const Alert: FC<AlertProps> = ({ | |||
const iconViewStyle: ViewStyle = { | |||
flexDirection: 'row', | |||
// Below keeps icon aligned with first row of text, centered, and scalable | |||
// If Text variant for header changes, token referenced in minHeight must change accordingly |
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.
Not sure if there's any good way to rework, but seems unlikely this comment would be noticed in that eventuality.
const getTextStyle = (pressed: boolean): TextStyle => ({ | ||
...typography.vadsFontBodyLarge, | ||
fontFamily: family.vadsFontFamilySansSerifBold, | ||
marginBottom: 0, |
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.
Should maybe use the none spacing token.
...font, | ||
...typography.vadsFontBodyLarge, | ||
fontFamily: isSelected ? 'SourceSansPro-Bold' : 'SourceSansPro-Regular', | ||
marginBottom: 0, |
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.
Similar token suggestion.
...font, | ||
...typography.vadsFontBodyLarge, | ||
fontFamily: isSelected ? 'SourceSansPro-Bold' : 'SourceSansPro-Regular', | ||
marginBottom: 0, | ||
color: theme.vadsColorForegroundDefault, |
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.
Did none of the tones work here? Seems like with the Text updates to include bold
and center
that maybe this could still use the Text component?
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.
Couldn't use Text component here due to the allowFontScaling
prop used on line 121, unless we add that prop.
...typography.vadsFontBodyLarge, | ||
marginBottom: 0, | ||
color: theme.vadsColorForegroundDefault, |
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.
Can't this be handled by our Text component with default tone and none bottomSpacing?
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.
Oh, or can it not because the role
of heading while being body text?
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.
Yup. This was done due to the role
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.
Approving since the whole seems alright, but some comments that likely should be addressed prior to merging.
…r Label and required text
…ext-tokens-or-component
@@ -79,6 +79,9 @@ export const Text: FC<TextProps> = ({ | |||
variant = 'body', | |||
}) => { | |||
const theme = useTheme() | |||
|
|||
if (!children) return null |
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.
Was this needed for TS to not get upset about the bold check or just a random piece of "defensive" code?
import { useTranslation } from 'react-i18next' | ||
import React, { FC } from 'react' | ||
|
||
import { SpacerSize } from '../Spacer/Spacer' |
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.
Calling attention to this since I assume it's going to cause linting failures in main.
Description of Change
flexShrink
orallowFontScaling
{ Text as RNText }
when import from react-native to differentiate between RN component and DS componentTesting Packages
Screenshots/Video
Alert Before/after
Button Before/after
Checkbox Before/after
CheckboxGroup Before/after
CheckboxGroup (Tiled) Before/after
Link Before/after
LoadingIndicator Before/after
RadioButton Before/after
SegmentedControl Before/after
Snackbar Before/after
Testing
PR Checklist
Code reviewer validation:
changelog
label applied if it's to be included in the changelogPublish
If changes warrant a new version per the versioning guidelines and the PR is approved and ready to merge:
main
into branchmain