2020-05-08 17:36:10 +00:00
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { Text, View } from 'react-native';
|
2020-05-08 17:36:10 +00:00
|
|
|
|
|
|
|
import Markdown from '../../containers/markdown';
|
2022-03-03 21:46:53 +00:00
|
|
|
import { useTheme } from '../../theme';
|
2021-09-13 20:41:05 +00:00
|
|
|
import styles from './styles';
|
2020-05-08 17:36:10 +00:00
|
|
|
|
2022-03-03 21:46:53 +00:00
|
|
|
interface IItem {
|
|
|
|
label?: string;
|
|
|
|
content?: string;
|
|
|
|
testID?: string;
|
|
|
|
}
|
|
|
|
|
2023-09-26 14:33:53 +00:00
|
|
|
const Item = ({ label, content, testID }: IItem): React.ReactElement | null => {
|
|
|
|
const { colors } = useTheme();
|
2022-03-03 21:46:53 +00:00
|
|
|
|
2023-09-26 14:33:53 +00:00
|
|
|
if (!content) return null;
|
2022-03-03 21:46:53 +00:00
|
|
|
|
|
|
|
return (
|
2020-05-20 16:33:40 +00:00
|
|
|
<View style={styles.item} testID={testID}>
|
2023-09-26 14:33:53 +00:00
|
|
|
<Text accessibilityLabel={label} style={[styles.itemLabel, { color: colors.titleText }]}>
|
2021-09-13 20:41:05 +00:00
|
|
|
{label}
|
|
|
|
</Text>
|
2023-09-26 14:33:53 +00:00
|
|
|
<Markdown style={[styles.itemContent, { color: colors.auxiliaryText }]} msg={content} />
|
2020-05-08 17:36:10 +00:00
|
|
|
</View>
|
2022-03-03 21:46:53 +00:00
|
|
|
);
|
2020-05-08 17:36:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Item;
|