dhre-ui-kit 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -0,0 +1,167 @@
1
+ import React from 'react';
2
+ import {
3
+ View,
4
+ Pressable,
5
+ StyleSheet,
6
+ Modal,
7
+ Linking,
8
+ Platform,
9
+ Alert,
10
+ } from 'react-native';
11
+ import CustomText from '../customText';
12
+ import Line from '../horizontalLine/Line';
13
+ import {withThemeProvider} from '../../theme/withThemeProvider';
14
+
15
+ interface ContactModalProps {
16
+ phoneNumber: string;
17
+ visible: boolean;
18
+ onClose: () => void;
19
+ isMailOpen: boolean;
20
+ }
21
+
22
+ const ContactModal: React.FC<ContactModalProps> = ({
23
+ phoneNumber,
24
+ visible,
25
+ onClose,
26
+ isMailOpen,
27
+ }) => {
28
+ const handleCall = () => {
29
+ if (Platform.OS === 'ios') {
30
+ Alert.alert('Phone calls are not supported on the iOS simulator.');
31
+ } else {
32
+ Linking.openURL(`tel:${phoneNumber}`);
33
+ }
34
+ onClose();
35
+ };
36
+
37
+ const handleOptionPress = (appName: string) => {
38
+ console.log(`Opening ${appName}`);
39
+ onClose();
40
+ };
41
+
42
+ const emailOptions = ['Mail', 'Gmail', 'Outlook'];
43
+ const renderEmailOptions = () => (
44
+ <>
45
+ <CustomText
46
+ style={styles.title}
47
+ text="Open email app"
48
+ variant="L2_REGULAR"
49
+ />
50
+ <CustomText
51
+ style={styles.subtitle}
52
+ text="Which app would you like to open?"
53
+ variant="L2_REGULAR"
54
+ />
55
+ {emailOptions.map(option => (
56
+ <React.Fragment key={option}>
57
+ <Line />
58
+ <Pressable
59
+ onPress={() => handleOptionPress(option)}
60
+ style={styles.optionButton}>
61
+ <CustomText
62
+ style={styles.optionText}
63
+ text={option}
64
+ variant="B3_BOLD"
65
+ />
66
+ </Pressable>
67
+ </React.Fragment>
68
+ ))}
69
+ </>
70
+ );
71
+
72
+ const renderContent = () => (
73
+ <>
74
+ <View style={styles.viewContainer}>
75
+ {isMailOpen ? (
76
+ renderEmailOptions()
77
+ ) : (
78
+ <Pressable onPress={handleCall} style={styles.optionButton}>
79
+ <CustomText
80
+ style={styles.optionText}
81
+ text={`Call ${phoneNumber}`}
82
+ variant="B3_BOLD"
83
+ />
84
+ </Pressable>
85
+ )}
86
+ </View>
87
+ <Pressable onPress={onClose} style={styles.cancelButton}>
88
+ <CustomText
89
+ style={styles.cancelText}
90
+ text="Cancel"
91
+ variant="B2_REGULAR"
92
+ />
93
+ </Pressable>
94
+ </>
95
+ );
96
+
97
+ return (
98
+ <View style={styles.container}>
99
+ <Modal
100
+ animationType="slide"
101
+ transparent
102
+ visible={visible}
103
+ onRequestClose={onClose}>
104
+ <View style={styles.modalContainer}>
105
+ <View style={styles.modalContent}>{renderContent()}</View>
106
+ </View>
107
+ </Modal>
108
+ </View>
109
+ );
110
+ };
111
+
112
+ const styles = StyleSheet.create({
113
+ container: {
114
+ flex: 1,
115
+ justifyContent: 'center',
116
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
117
+ },
118
+ modalContainer: {
119
+ flex: 1,
120
+ justifyContent: 'flex-end',
121
+ alignItems: 'center',
122
+ backgroundColor: 'rgba(0, 0, 0, .7)',
123
+ },
124
+ modalContent: {
125
+ padding: 20,
126
+ width: '100%',
127
+ alignItems: 'center',
128
+ marginHorizontal: 20,
129
+ borderRadius: 10,
130
+ },
131
+ viewContainer: {
132
+ width: '100%',
133
+ backgroundColor: '#1C1C1E',
134
+ borderRadius: 10,
135
+ },
136
+ cancelText: {
137
+ color: '#007AFF',
138
+ },
139
+ title: {
140
+ textAlign: 'center',
141
+ marginTop: 13,
142
+ },
143
+ subtitle: {
144
+ textAlign: 'center',
145
+ marginTop: 2,
146
+ marginBottom: 13,
147
+ },
148
+ optionButton: {
149
+ padding: 16,
150
+ borderRadius: 8,
151
+ alignItems: 'center',
152
+ },
153
+ optionText: {
154
+ fontSize: 16,
155
+ color: '#007AFF',
156
+ },
157
+ cancelButton: {
158
+ marginTop: 10,
159
+ paddingVertical: 15,
160
+ alignItems: 'center',
161
+ borderRadius: 8,
162
+ backgroundColor: '#1C1C1E',
163
+ width: '100%',
164
+ },
165
+ });
166
+
167
+ export default withThemeProvider(ContactModal);
@@ -0,0 +1 @@
1
+ export {default} from './ContactModel';
@@ -0,0 +1,91 @@
1
+ import React, {ReactElement} from 'react';
2
+ import {TouchableOpacity, View, StyleSheet, ViewStyle} from 'react-native';
3
+ import {SvgProps} from 'react-native-svg';
4
+ import CustomText from '../customText';
5
+ import {withThemeProvider} from '../../theme/withThemeProvider';
6
+ import {useTheme} from 'src/theme/ThemeContext';
7
+
8
+ interface OurOfficesButtonProps {
9
+ leftIcon?: ReactElement<SvgProps>;
10
+ rightIcon?: ReactElement<SvgProps>;
11
+ onPress: () => void;
12
+ title: string;
13
+ description: string;
14
+ containerStyle?: ViewStyle;
15
+ titleVariant?: string;
16
+ descriptionVariant?: string;
17
+ titleColor?: string;
18
+ descriptionColor?: string;
19
+ }
20
+
21
+ const OurOfficesButton = ({
22
+ leftIcon,
23
+ rightIcon,
24
+ onPress,
25
+ title,
26
+ description,
27
+ containerStyle,
28
+ titleVariant = 'L1_REGULAR',
29
+ descriptionVariant = 'L1_REGULAR',
30
+ titleColor = 'CONTENT_PRIMARY',
31
+ descriptionColor = 'CONTENT_SECONDARY',
32
+ }: OurOfficesButtonProps) => {
33
+ const {theme} = useTheme();
34
+ return (
35
+ <TouchableOpacity
36
+ style={[
37
+ styles.button,
38
+ {backgroundColor: theme['SURFACE_SECONDARY']},
39
+ containerStyle,
40
+ ]}
41
+ onPress={onPress}>
42
+ {leftIcon && (
43
+ <View style={styles.iconContainer}>{React.cloneElement(leftIcon)}</View>
44
+ )}
45
+ <View style={styles.textContainer}>
46
+ <CustomText
47
+ text={title}
48
+ variant={titleVariant}
49
+ textColor={titleColor}
50
+ style={styles.textView}
51
+ />
52
+ <CustomText
53
+ text={description}
54
+ variant={descriptionVariant}
55
+ textColor={descriptionColor}
56
+ style={styles.flexWrap}
57
+ />
58
+ </View>
59
+ {rightIcon && (
60
+ <View style={styles.rightIconContainer}>
61
+ {React.cloneElement(rightIcon)}
62
+ </View>
63
+ )}
64
+ </TouchableOpacity>
65
+ );
66
+ };
67
+
68
+ const styles = StyleSheet.create({
69
+ button: {
70
+ flexDirection: 'row',
71
+ alignItems: 'center',
72
+ borderRadius: 10,
73
+ },
74
+ iconContainer: {
75
+ marginHorizontal: 16,
76
+ },
77
+ textContainer: {
78
+ flex: 1,
79
+ padding: 10,
80
+ borderRadius: 4,
81
+ },
82
+ rightIconContainer: {
83
+ marginLeft: 10,
84
+ position: 'absolute',
85
+ right: 10,
86
+ },
87
+ textView: {marginBottom: 4},
88
+ flexWrap: {flexWrap: 'wrap'},
89
+ });
90
+
91
+ export default withThemeProvider(OurOfficesButton);
@@ -0,0 +1 @@
1
+ export {default} from './OurOffices';
@@ -49,7 +49,7 @@ const CustomButton = ({
49
49
  <CustomText
50
50
  text={title}
51
51
  variant={titleVariant}
52
- style={[textStyle, {color: '#A7A7A7'}]}
52
+ style={[{color: '#A7A7A7'}, textStyle]}
53
53
  textColor={titleColor}
54
54
  />
55
55
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import {View, StyleSheet, ViewStyle} from 'react-native';
3
3
  import {useTheme} from '../../theme/ThemeContext';
4
+ import {withThemeProvider} from '../../theme/withThemeProvider';
4
5
 
5
6
  const HorizontalLine = ({style}: {style?: ViewStyle}) => {
6
7
  const {theme} = useTheme();
@@ -22,4 +23,4 @@ const styles = StyleSheet.create({
22
23
  },
23
24
  });
24
25
 
25
- export default HorizontalLine;
26
+ export default withThemeProvider(HorizontalLine);
@@ -3,6 +3,7 @@ import {TouchableOpacity, View, StyleSheet, ViewStyle} from 'react-native';
3
3
  import {SvgProps} from 'react-native-svg';
4
4
  import {useTheme} from '../../theme/ThemeContext';
5
5
  import CustomText from '../customText';
6
+ import {withThemeProvider} from '../../theme/withThemeProvider';
6
7
 
7
8
  interface OurOfficesButtonProps {
8
9
  rightIcon?: ReactElement<SvgProps>;
@@ -81,4 +82,4 @@ const styles = StyleSheet.create({
81
82
  },
82
83
  });
83
84
 
84
- export default Topic;
85
+ export default withThemeProvider(Topic);
package/src/index.ts CHANGED
@@ -27,5 +27,7 @@ export {default as CustomIcon} from './components/customIcon';
27
27
  export {default as CustomLoader} from './components/customLoader';
28
28
  export {default as Line} from './components/horizontalLine';
29
29
  export {default as Topic} from './components/topic';
30
+ export {default as ContactModel} from './components/ContactModel';
31
+ export {default as OurOfficesButton} from './components/OutOfOffice';
30
32
 
31
33
  export * from './utils/stylehelper';