-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into convert-ts-scaling-435
- Loading branch information
Showing
142 changed files
with
5,975 additions
and
1,266 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
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
11 changes: 11 additions & 0 deletions
11
app/component-library/components-temp/KeyValueRow/KeyValueLabel/KeyValueLabel.styles.tsx
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,11 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
const styleSheet = () => | ||
StyleSheet.create({ | ||
labelContainer: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
}, | ||
}); | ||
|
||
export default styleSheet; |
64 changes: 64 additions & 0 deletions
64
app/component-library/components-temp/KeyValueRow/KeyValueLabel/KeyValueLabel.tsx
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,64 @@ | ||
import ButtonIcon from '../../../../component-library/components/Buttons/ButtonIcon'; | ||
import Label from '../../../../component-library/components/Form/Label'; | ||
import { | ||
IconColor, | ||
IconName, | ||
} from '../../../../component-library/components/Icons/Icon'; | ||
import { | ||
TextVariant, | ||
TextColor, | ||
} from '../../../../component-library/components/Texts/Text'; | ||
import { useStyles } from '../../../../component-library/hooks'; | ||
import useTooltipModal from '../../../../components/hooks/useTooltipModal'; | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import { KeyValueRowLabelProps, TooltipSizes } from '../KeyValueRow.types'; | ||
import styleSheet from './KeyValueLabel.styles'; | ||
|
||
/** | ||
* A label and tooltip component. | ||
* | ||
* @param {Object} props - Component props. | ||
* @param {TextVariant} [props.variant] - Optional text variant. Defaults to TextVariant.BodyMDMedium. | ||
* @param {TextVariant} [props.color] - Optional text color. Defaults to TextColor.Default. | ||
* @param {TextVariant} [props.tooltip] - Optional tooltip to render to the right of the label text. | ||
* | ||
* @returns {JSX.Element} The rendered KeyValueRowLabel component. | ||
*/ | ||
const KeyValueRowLabel = ({ | ||
label, | ||
variant = TextVariant.BodyMDMedium, | ||
color = TextColor.Default, | ||
tooltip, | ||
}: KeyValueRowLabelProps) => { | ||
const { styles } = useStyles(styleSheet, {}); | ||
|
||
const { openTooltipModal } = useTooltipModal(); | ||
|
||
const hasTooltip = tooltip?.title && tooltip?.text; | ||
|
||
const onNavigateToTooltipModal = () => { | ||
if (!hasTooltip) return; | ||
openTooltipModal(tooltip.title, tooltip.text); | ||
}; | ||
|
||
return ( | ||
<View style={styles.labelContainer}> | ||
<Label variant={variant} color={color}> | ||
{label} | ||
</Label> | ||
{hasTooltip && ( | ||
<ButtonIcon | ||
size={tooltip.size ?? TooltipSizes.Md} | ||
iconColor={IconColor.Muted} | ||
iconName={IconName.Info} | ||
accessibilityRole="button" | ||
accessibilityLabel={`${tooltip.title}} tooltip`} | ||
onPress={onNavigateToTooltipModal} | ||
/> | ||
)} | ||
</View> | ||
); | ||
}; | ||
|
||
export default KeyValueRowLabel; |
13 changes: 13 additions & 0 deletions
13
app/component-library/components-temp/KeyValueRow/KeyValueRoot/KeyValueRoot.styles.tsx
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,13 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
const styleSheet = () => | ||
StyleSheet.create({ | ||
rootContainer: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
overflow: 'hidden', | ||
}, | ||
}); | ||
|
||
export default styleSheet; |
37 changes: 37 additions & 0 deletions
37
app/component-library/components-temp/KeyValueRow/KeyValueRoot/KeyValueRoot.tsx
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,37 @@ | ||
import { useStyles } from '../../../hooks'; | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import { KeyValueRowRootProps } from '../KeyValueRow.types'; | ||
import styleSheet from './KeyValueRoot.styles'; | ||
|
||
/** | ||
* The main container for the KeyValueRow component. | ||
* When creating custom KeyValueRow components, this must be the outermost component wrapping the two <KeyValueSection/> components. | ||
* | ||
* e.g. | ||
* ``` | ||
* <KeyValueRowRoot> | ||
* <KeyValueSection></KeyValueSection> | ||
* <KeyValueSection></KeyValueSection> | ||
* </KeyValueRowRoot> | ||
* ``` | ||
* | ||
* @component | ||
* @param {Object} props - Component props. | ||
* @param {Array<ReactNode>} props.children - The two <KeyValueSection> children. | ||
* @param {ViewProps} [props.style] - Optional styling | ||
* | ||
* @returns {JSX.Element} The rendered Root component. | ||
*/ | ||
const KeyValueRowRoot = ({ | ||
children, | ||
style: customStyles, | ||
}: KeyValueRowRootProps) => { | ||
const { styles: defaultStyles } = useStyles(styleSheet, {}); | ||
|
||
const styles = [defaultStyles.rootContainer, customStyles]; | ||
|
||
return <View style={styles}>{children}</View>; | ||
}; | ||
|
||
export default KeyValueRowRoot; |
Oops, something went wrong.