-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathPerpsMoreSection.tsx
More file actions
95 lines (89 loc) · 2.01 KB
/
Copy pathPerpsMoreSection.tsx
File metadata and controls
95 lines (89 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import React from 'react';
import { TouchableOpacity, View } from 'react-native';
import {
FontWeight,
Icon,
IconColor,
IconName,
IconSize,
SectionHeader,
Text,
TextColor,
TextVariant,
} from '@metamask/design-system-react-native';
import { strings } from '../../../../../../locales/i18n';
import styles from './PerpsMoreSection.styles';
import { PerpsMoreSectionTestIds } from './PerpsMoreSection.testIds';
export interface PerpsMoreItem {
label: string;
startIconName: IconName;
endIconName?: IconName;
onPress: () => void;
testID: string;
}
interface PerpsMoreSectionProps {
items: PerpsMoreItem[];
testID?: string;
}
interface PerpsMoreActionRowProps {
label: string;
startIconName: IconName;
endIconName?: IconName;
onPress: () => void;
testID: string;
}
const PerpsMoreActionRow = ({
label,
startIconName,
endIconName,
onPress,
testID,
}: PerpsMoreActionRowProps) => (
<TouchableOpacity
accessibilityRole="button"
onPress={onPress}
style={styles.row}
testID={testID}
>
<Icon
name={startIconName}
size={IconSize.Md}
color={IconColor.IconDefault}
style={styles.startIcon}
/>
<Text
variant={TextVariant.BodyMd}
fontWeight={FontWeight.Medium}
color={TextColor.TextDefault}
style={styles.label}
>
{label}
</Text>
{endIconName ? (
<Icon
name={endIconName}
size={IconSize.Md}
color={IconColor.IconAlternative}
/>
) : null}
</TouchableOpacity>
);
const PerpsMoreSection = ({
items,
testID = PerpsMoreSectionTestIds.SECTION,
}: PerpsMoreSectionProps) => (
<View testID={testID}>
<SectionHeader title={strings('homepage.sections.more.title')} />
{items.map((item) => (
<PerpsMoreActionRow
key={item.testID}
label={item.label}
startIconName={item.startIconName}
endIconName={item.endIconName}
onPress={item.onPress}
testID={item.testID}
/>
))}
</View>
);
export default PerpsMoreSection;