aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/TaggSquareButton.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-02-01 17:05:18 -0500
committerIvan Chen <ivan@tagg.id>2021-02-02 18:44:04 -0500
commitbd9ed0712bae14729d18f4d34b891bb82d4550ff (patch)
tree74acece7caadcc30a130e279c058cf7ee4baa63e /src/components/common/TaggSquareButton.tsx
parent00adcf1eddd51d954992dfd5a494ee5310d42d5b (diff)
initial work
Diffstat (limited to 'src/components/common/TaggSquareButton.tsx')
-rw-r--r--src/components/common/TaggSquareButton.tsx80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/components/common/TaggSquareButton.tsx b/src/components/common/TaggSquareButton.tsx
new file mode 100644
index 00000000..41e0b891
--- /dev/null
+++ b/src/components/common/TaggSquareButton.tsx
@@ -0,0 +1,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;