From bd9ed0712bae14729d18f4d34b891bb82d4550ff Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Mon, 1 Feb 2021 17:05:18 -0500
Subject: initial work

---
 src/components/common/TaggSquareButton.tsx | 80 ++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 src/components/common/TaggSquareButton.tsx

(limited to 'src/components/common/TaggSquareButton.tsx')

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;
-- 
cgit v1.2.3-70-g09d2

