aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/TaggPrompt.tsx
blob: 6b59d4a5478d93beaf7b9643313c7e1b7fba1ca0 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import React from 'react';
import {StyleSheet, Text, TouchableOpacity} from 'react-native';
import {Image, View} from 'react-native-animatable';
import CloseIcon from '../../assets/ionicons/close-outline.svg';
import {normalize, SCREEN_HEIGHT} from '../../utils';

type TaggPromptProps = {
  messageHeader: string;
  messageBody: string | Element;
  logoType: 'plus' | 'tagg' | 'invite_friends' | 'private_accounts';
  hideCloseButton?: boolean;
  noPadding?: boolean;
  onClose: () => void;
};

const TaggPrompt: React.FC<TaggPromptProps> = ({
  messageHeader,
  messageBody,
  logoType,
  hideCloseButton,
  noPadding,
  onClose,
}) => {
  /**
   * Generic prompt for Tagg
   */

  const logo = () => {
    switch (logoType) {
      case 'plus':
        return require('../../assets/icons/notificationPrompts/plus-logo.png');
      case 'invite_friends':
        return require('../../assets/icons/notificationPrompts/invite-friends-prompt-icon.png');
      case 'private_accounts':
        return require('../../assets/icons/notificationPrompts/private-accounts-prompt-icon.png');
      case 'tagg':
      default:
        return require('../../assets/images/logo-purple.png');
    }
  };

  const topPadding = {paddingTop: noPadding ? 0 : SCREEN_HEIGHT / 10};
  const bottomPadding = {paddingBottom: noPadding ? 0 : SCREEN_HEIGHT / 50};

  return (
    <View style={[styles.container, topPadding, bottomPadding]}>
      <Image style={styles.icon} source={logo()} />
      <Text style={styles.header}>{messageHeader}</Text>
      <Text style={styles.subtext}>{messageBody}</Text>
      {!hideCloseButton && (
        <TouchableOpacity
          style={styles.closeButton}
          onPress={() => {
            onClose();
          }}>
          <CloseIcon height={'50%'} width={'50%'} color="gray" />
        </TouchableOpacity>
      )}
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'white',
    height: SCREEN_HEIGHT / 4,
  },
  closeButton: {
    position: 'relative',
    height: '40%',
    bottom: SCREEN_HEIGHT / 6,
    aspectRatio: 1,
    alignSelf: 'flex-end',
  },
  icon: {
    width: normalize(40),
    height: normalize(40),
  },
  header: {
    color: 'black',
    fontSize: normalize(16),
    fontWeight: '600',
    textAlign: 'center',
    marginTop: '2%',
  },
  subtext: {
    color: 'gray',
    fontSize: normalize(12),
    fontWeight: '500',
    lineHeight: normalize(20),
    textAlign: 'center',
    marginTop: '2%',
    width: '95%',
  },
});
export default TaggPrompt;