diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-09 19:49:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 19:49:27 -0400 |
commit | 9d5ad9bea36c0b2abffd04b25126d18158017137 (patch) | |
tree | 7d7c58cbdb67e3e0945a6ed2ccaa658f0048e887 /src/components/common/BasicButton.tsx | |
parent | a6580f418e87775a5e683e56735952df4f7fa5a9 (diff) | |
parent | ad9db5ffd0b2fb6334fd8237e0600a76d25c7053 (diff) |
Merge pull request #356 from shravyaramesh/tma767-message-button
[TMA767] Message button
Diffstat (limited to 'src/components/common/BasicButton.tsx')
-rw-r--r-- | src/components/common/BasicButton.tsx | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/components/common/BasicButton.tsx b/src/components/common/BasicButton.tsx new file mode 100644 index 00000000..1fe29cd9 --- /dev/null +++ b/src/components/common/BasicButton.tsx @@ -0,0 +1,77 @@ +import React from 'react'; +import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'; +import {TAGG_LIGHT_BLUE} from '../../constants'; +import {TouchableOpacity} from 'react-native-gesture-handler'; +import {normalize} from '../../utils'; + +interface BasicButtonProps { + title: string; + onPress: () => void; + solid?: boolean; + externalStyles?: Record<string, StyleProp<ViewStyle>>; +} +const BasicButton: React.FC<BasicButtonProps> = ({ + title, + onPress, + solid, + externalStyles, +}) => { + return ( + <View style={[styles.container, externalStyles?.container]}> + <TouchableOpacity + style={[ + styles.genericButtonStyle, + solid ? styles.solidButton : styles.outlineButton, + ]} + onPress={onPress}> + <Text + style={[ + styles.buttonTitle, + solid + ? styles.solidButtonTitleColor + : styles.outlineButtonTitleColor, + ]}> + {title} + </Text> + </TouchableOpacity> + </View> + ); +}; + +const styles = StyleSheet.create({ + container: { + height: '100%', + flexDirection: 'column', + justifyContent: 'space-around', + }, + genericButtonStyle: { + justifyContent: 'center', + alignItems: 'center', + borderRadius: 3, + padding: 0, + width: '100%', + height: '100%', + }, + solidButton: { + padding: 0, + backgroundColor: TAGG_LIGHT_BLUE, + }, + outlineButton: { + borderWidth: 2, + backgroundColor: 'white', + borderColor: TAGG_LIGHT_BLUE, + }, + solidButtonTitleColor: { + color: 'white', + }, + outlineButtonTitleColor: { + color: TAGG_LIGHT_BLUE, + }, + buttonTitle: { + fontSize: normalize(15), + fontWeight: '700', + letterSpacing: 1, + }, +}); + +export default BasicButton; |