-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/9733-VAIconWithTextMigration (#9734)
Co-authored-by: Tim Wright <[email protected]>
- Loading branch information
1 parent
cde2cc8
commit 1edd172
Showing
33 changed files
with
124 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
VAMobile/documentation/docs/Flagship design library/Foundation/Icons/navIcons.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { FC } from 'react' | ||
|
||
import { Icon, IconProps } from '@department-of-veterans-affairs/mobile-component-library/src/components/Icon/Icon' | ||
|
||
import { Box, ColorVariant, TextView, TextViewProps } from 'components' | ||
|
||
export type IconWithTextProps = IconProps & { | ||
/** label to display below icon */ | ||
label: string | ||
/** label color variant. default is textWithIconButton */ | ||
labelColor?: ColorVariant | ||
/** optional a11y label */ | ||
labelA11y?: string | ||
/** optional margin between text and icon */ | ||
mt?: number | ||
} | ||
|
||
/** | ||
* Display icon with text label underneath | ||
* | ||
* @returns IconWithText component | ||
*/ | ||
const IconWithText: FC<IconWithTextProps> = ({ label, labelColor, labelA11y, mt, ...iconProps }) => { | ||
const props: IconProps = { | ||
...iconProps, | ||
fill: iconProps.fill || 'link', | ||
height: iconProps.height || 24, | ||
width: iconProps.width || 24, | ||
preventScaling: iconProps.preventScaling ?? true, | ||
} | ||
|
||
const textProps: TextViewProps = { | ||
variant: 'textWithIconButton', | ||
mt: mt || 3, // 6px total combined with line height | ||
color: labelColor || 'textWithIconButton', | ||
accessibilityLabel: labelA11y, | ||
allowFontScaling: false, | ||
} | ||
|
||
return ( | ||
<Box alignItems="center"> | ||
<Icon {...props} /> | ||
<TextView {...textProps}>{label}</TextView> | ||
</Box> | ||
) | ||
} | ||
|
||
export default IconWithText |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './IconWithText' | ||
export { default } from './IconWithText' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.