Skip to content

Commit

Permalink
Add disablePadding prop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandec committed Sep 19, 2024
1 parent 7361e0f commit 87eca78
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
9 changes: 8 additions & 1 deletion VAMobile/src/components/ClickForActionLinkDeprecated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export type LinkButtonProps = AccessibilityProps & {
/** hide icon */
hideIcon?: boolean

/** disable padding */
disablePadding?: boolean

/** Optional TestID */
testID?: string
}
Expand All @@ -99,10 +102,14 @@ const ClickForActionLinkDeprecated: FC<LinkButtonProps> = ({
colorOverride,
customOnPress,
hideIcon = false,
disablePadding = false,
testID,
...props
}) => {
const theme = useTheme()
const py = disablePadding ? 0 : theme.dimensions.buttonPadding
const pr = disablePadding ? 0 : theme.dimensions.gutter

const launchExternalLink = useExternalLink()

const onCalendarPress = async (): Promise<void> => {
Expand Down Expand Up @@ -191,7 +198,7 @@ const ClickForActionLinkDeprecated: FC<LinkButtonProps> = ({

return (
<TouchableWithoutFeedback testID={testID} {...pressableProps}>
<Box flexDirection={'row'} alignItems={'center'}>
<Box flexDirection={'row'} alignItems={'center'} py={py} pr={pr}>
{!hideIcon && (
<VAIcon
name={getIconName()}
Expand Down
31 changes: 15 additions & 16 deletions VAMobile/src/components/LinkWithAnalytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,21 @@ const LinkWithAnalytics = ({ analyticsOnPress, analyticsProps, disablePadding, .
const hideIcon = props.icon === 'no icon'

return (
<Box flexDirection={'row'} flexWrap="wrap" py={py} pr={pr}>
<ClickForActionLinkDeprecated
displayedText={props.text}
linkType={LinkTypeOptionsConstants[linkType as keyof typeof LinkTypeOptionsConstants]}
numberOrUrlLink={props.url || props.phoneNumber || props.TTYnumber || props.textNumber || directionsURL}
linkUrlIconType={LinkUrlIconType.Arrow}
a11yLabel={props.a11yLabel || props.text}
fireAnalytic={() => {
props.analytics?.onPress?.()
analyticsOnPress && analyticsOnPress()
}}
customOnPress={props.onPress}
hideIcon={hideIcon}
testID={props.testID}
/>
</Box>
<ClickForActionLinkDeprecated
displayedText={props.text}
linkType={LinkTypeOptionsConstants[linkType as keyof typeof LinkTypeOptionsConstants]}
numberOrUrlLink={props.url || props.phoneNumber || props.TTYnumber || props.textNumber || directionsURL}
linkUrlIconType={LinkUrlIconType.Arrow}
a11yLabel={props.a11yLabel || props.text}
fireAnalytic={() => {
props.analytics?.onPress?.()
analyticsOnPress && analyticsOnPress()
}}
customOnPress={props.onPress}
hideIcon={hideIcon}
disablePadding={disablePadding}
testID={props.testID}
/>
)
} else {
return (
Expand Down

0 comments on commit 87eca78

Please sign in to comment.