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
|
import React from 'react';
import {
GestureResponderEvent,
StyleSheet,
Text,
TouchableOpacity,
ViewProps,
ViewStyle,
} from 'react-native';
import {normalize} from '../../utils';
interface TaggSquareButtonProps extends ViewProps {
onPress: (event: GestureResponderEvent) => void;
title: string;
mode: 'normal' | 'large';
color: 'purple' | 'white';
style?: ViewStyle;
}
const TaggSquareButton: React.FC<TaggSquareButtonProps> = (props) => {
const color = (() => {
switch (props.color) {
case 'purple':
return '#8F01FF';
case 'white':
default:
return 'white';
}
})();
switch (props.mode) {
case 'large':
return (
<TouchableOpacity
onPress={props.onPress}
style={[styles.normalButton, {backgroundColor: color}, props.style]}>
<Text style={styles.normalLabel}>{props.title}</Text>
</TouchableOpacity>
);
case 'normal':
default:
return (
<TouchableOpacity
onPress={props.onPress}
style={[styles.normalButton, {backgroundColor: color}, props.style]}>
<Text style={styles.normalLabel}>{props.title}</Text>
</TouchableOpacity>
);
}
};
const styles = StyleSheet.create({
largeButton: {
justifyContent: 'center',
alignItems: 'center',
width: '70%',
height: '10%',
borderRadius: 5,
// marginBottom: '15%',
},
largeLabel: {
fontSize: normalize(30),
fontWeight: '500',
color: '#ddd',
},
normalButton: {
justifyContent: 'center',
alignItems: 'center',
width: '70%',
height: '10%',
borderRadius: 5,
// marginBottom: '15%',
},
normalLabel: {
fontSize: normalize(24),
fontWeight: '500',
color: '#ddd',
},
});
export default TaggSquareButton;
|