-
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
Changes from all commits
eee3217
60d3ac9
e90b806
2ce35bb
dd65d97
2e615d0
9d5789c
e1d5336
87fa448
5402a2d
419a80b
3b74dde
3c2c278
3d754e2
56d4301
3ebba55
ed670bd
9fdfbc2
bd41f7c
270ab94
0b1e806
55f8107
88a50b1
6f5c016
8a37721
46322b7
7df1aad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { Pressable, Text, TextStyle, View, ViewStyle } from 'react-native' | ||
import { spacing } from '@department-of-veterans-affairs/mobile-tokens' | ||
import { | ||
Pressable, | ||
Text as RNText, | ||
TextStyle, | ||
View, | ||
ViewStyle, | ||
} from 'react-native' | ||
import { font, spacing } from '@department-of-veterans-affairs/mobile-tokens' | ||
import { useTranslation } from 'react-i18next' | ||
import React, { FC, useEffect } from 'react' | ||
import styled from 'styled-components/native' | ||
|
@@ -54,6 +60,7 @@ export const SegmentedControl: FC<SegmentedControlProps> = ({ | |
}) => { | ||
const theme = useTheme() | ||
const { t } = useTranslation() | ||
const { typography } = font | ||
|
||
useEffect(() => { | ||
onChange(selected) | ||
|
@@ -89,15 +96,10 @@ export const SegmentedControl: FC<SegmentedControlProps> = ({ | |
total: labels.length, | ||
}) | ||
|
||
// TODO: Replace with typography tokens | ||
const font: TextStyle = { | ||
fontFamily: isSelected ? 'SourceSansPro-Bold' : 'SourceSansPro-Regular', | ||
fontSize: 20, | ||
lineHeight: 30, | ||
} | ||
|
||
const textStyle: TextStyle = { | ||
...font, | ||
...typography.vadsFontBodyLarge, | ||
fontFamily: isSelected ? 'SourceSansPro-Bold' : 'SourceSansPro-Regular', | ||
marginBottom: spacing.vadsSpaceNone, | ||
color: theme.vadsColorForegroundDefault, | ||
textAlign: 'center', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't use Text component here due to the |
||
} | ||
|
@@ -116,9 +118,9 @@ export const SegmentedControl: FC<SegmentedControlProps> = ({ | |
accessibilityState={{ selected: isSelected }} | ||
style={PressableOpacityStyle()} | ||
testID={testIDs?.[index]}> | ||
<Text allowFontScaling={false} style={textStyle}> | ||
<RNText allowFontScaling={false} style={textStyle}> | ||
{label} | ||
</Text> | ||
</RNText> | ||
</Segment> | ||
) | ||
} | ||
|
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.