aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/TaggSquareButton.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@thetaggid.com>2021-02-11 12:23:03 -0500
committerGitHub <noreply@github.com>2021-02-11 12:23:03 -0500
commitd768712304ccdb016f8bef2a122fd25c01710a67 (patch)
treebad1bc9b04b91d4ae983343dad9971ab73d3071a /src/components/common/TaggSquareButton.tsx
parent0e9456692e9d0d0d0e8da483549b386c9af8df55 (diff)
parent952eb1b9b58362cc4ead737554872197ae8a89b1 (diff)
Merge pull request #232 from IvanIFChen/tma639-new-version-available
[TMA-639] New Version Available
Diffstat (limited to 'src/components/common/TaggSquareButton.tsx')
-rw-r--r--src/components/common/TaggSquareButton.tsx41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/components/common/TaggSquareButton.tsx b/src/components/common/TaggSquareButton.tsx
index 78a90554..817a2690 100644
--- a/src/components/common/TaggSquareButton.tsx
+++ b/src/components/common/TaggSquareButton.tsx
@@ -3,6 +3,7 @@ import {
GestureResponderEvent,
StyleSheet,
Text,
+ TextStyle,
TouchableOpacity,
ViewProps,
ViewStyle,
@@ -14,14 +15,16 @@ import {normalize, SCREEN_WIDTH} from '../../utils';
interface TaggSquareButtonProps extends ViewProps {
onPress: (event: GestureResponderEvent) => void;
title: string;
- mode: 'normal' | 'large' | 'gradient';
- color: 'purple' | 'white';
+ buttonStyle: 'normal' | 'large' | 'gradient';
+ buttonColor: 'purple' | 'white';
+ labelColor: 'white' | 'blue';
style?: ViewStyle;
+ labelStyle?: TextStyle;
}
const TaggSquareButton: React.FC<TaggSquareButtonProps> = (props) => {
- const buttonStyles = (() => {
- switch (props.color) {
+ const buttonColor = (() => {
+ switch (props.buttonColor) {
case 'purple':
return {backgroundColor: TAGG_PURPLE};
case 'white':
@@ -29,24 +32,37 @@ const TaggSquareButton: React.FC<TaggSquareButtonProps> = (props) => {
return {backgroundColor: 'white'};
}
})();
- switch (props.mode) {
+ const labelColor = (() => {
+ switch (props.labelColor) {
+ case 'white':
+ return {color: 'white'};
+ case 'blue':
+ default:
+ return {color: '#78A0EF'};
+ }
+ })();
+ switch (props.buttonStyle) {
case 'large':
return (
<TouchableOpacity
onPress={props.onPress}
- style={[styles.largeButton, buttonStyles, props.style]}>
- <Text style={styles.largeLabel}>{props.title}</Text>
+ style={[styles.largeButton, buttonColor, props.style]}>
+ <Text style={[styles.largeLabel, labelColor, props.labelStyle]}>
+ {props.title}
+ </Text>
</TouchableOpacity>
);
case 'gradient':
return (
- <TouchableOpacity onPress={props.onPress}>
+ <TouchableOpacity onPress={props.onPress} style={props.style}>
<LinearGradient
style={styles.gradientButton}
colors={BACKGROUND_GRADIENT_MAP[0]}
useAngle
angle={90}>
- <Text style={styles.gradientLabel}>{props.title}</Text>
+ <Text style={[styles.gradientLabel, props.labelStyle]}>
+ {props.title}
+ </Text>
</LinearGradient>
</TouchableOpacity>
);
@@ -55,8 +71,10 @@ const TaggSquareButton: React.FC<TaggSquareButtonProps> = (props) => {
return (
<TouchableOpacity
onPress={props.onPress}
- style={[styles.normalButton, buttonStyles, props.style]}>
- <Text style={styles.normalLabel}>{props.title}</Text>
+ style={[styles.normalButton, buttonColor, props.style]}>
+ <Text style={[styles.normalLabel, labelColor, props.labelStyle]}>
+ {props.title}
+ </Text>
</TouchableOpacity>
);
}
@@ -86,7 +104,6 @@ const styles = StyleSheet.create({
normalLabel: {
fontSize: normalize(20),
fontWeight: '500',
- color: '#78A0EF',
},
gradientButton: {
marginTop: '8%',