dhre-ui-kit 0.0.12 → 0.0.14

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.12",
3
+ "version": "0.0.14",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
package/src/App.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {ThemeProvider} from './theme/ThemeContext';
3
- import {Badge} from './index';
3
+ import {Badge, Line} from './index';
4
4
  import {ArrowLeft, CalenderDots} from './assets';
5
5
  import {View} from 'react-native';
6
6
  import CustomButton from './components/button/Button';
@@ -17,7 +17,7 @@ const App = () => {
17
17
  textStyle={{color: 'black'}}
18
18
  iconStyle={{}}
19
19
  />
20
-
20
+ <Line />
21
21
  <CustomButton
22
22
  title="Yes"
23
23
  onPress={() => console.log('Yes Button Pressed')}
@@ -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,26 @@
1
+ import React from 'react';
2
+ import {View, StyleSheet, ViewStyle} from 'react-native';
3
+ import {useTheme} from '../../theme/ThemeContext';
4
+ import {withThemeProvider} from '../../theme/withThemeProvider';
5
+
6
+ const HorizontalLine = ({style}: {style?: ViewStyle}) => {
7
+ const {theme} = useTheme();
8
+ return (
9
+ <View
10
+ style={[
11
+ styles.line,
12
+ {backgroundColor: theme['SURFACE_SECONDARY']},
13
+ style,
14
+ ]}
15
+ />
16
+ );
17
+ };
18
+
19
+ const styles = StyleSheet.create({
20
+ line: {
21
+ height: 1,
22
+ width: '100%',
23
+ },
24
+ });
25
+
26
+ export default withThemeProvider(HorizontalLine);
@@ -0,0 +1 @@
1
+ export {default} from './Line';
@@ -0,0 +1,85 @@
1
+ import React, {ReactElement} from 'react';
2
+ import {TouchableOpacity, View, StyleSheet, ViewStyle} from 'react-native';
3
+ import {SvgProps} from 'react-native-svg';
4
+ import {useTheme} from '../../theme/ThemeContext';
5
+ import CustomText from '../customText';
6
+ import {withThemeProvider} from '../../theme/withThemeProvider';
7
+
8
+ interface OurOfficesButtonProps {
9
+ rightIcon?: ReactElement<SvgProps>;
10
+ onPress: () => void;
11
+ title: string;
12
+ subTitle?: string;
13
+ containterStyle?: ViewStyle;
14
+ }
15
+ const Topic = ({
16
+ rightIcon,
17
+ onPress,
18
+ title,
19
+ subTitle,
20
+ containterStyle,
21
+ }: OurOfficesButtonProps) => {
22
+ const {theme} = useTheme();
23
+ return (
24
+ <TouchableOpacity
25
+ style={[
26
+ styles.button,
27
+ {backgroundColor: theme['SURFACE_SECONDARY']},
28
+ containterStyle,
29
+ ]}
30
+ onPress={onPress}>
31
+ {rightIcon && (
32
+ <View style={styles.rightIconContainer}>
33
+ {React.cloneElement(rightIcon)}
34
+ </View>
35
+ )}
36
+ <View style={styles.textContainer}>
37
+ {subTitle && (
38
+ <CustomText
39
+ text={subTitle}
40
+ variant="L3_REGULAR"
41
+ textColor="CONTENT_PRIMARY"
42
+ />
43
+ )}
44
+ <CustomText
45
+ text={title}
46
+ variant="L1_REGULAR"
47
+ textColor="CONTENT_PRIMARY"
48
+ />
49
+ </View>
50
+ </TouchableOpacity>
51
+ );
52
+ };
53
+
54
+ const styles = StyleSheet.create({
55
+ button: {
56
+ flexDirection: 'row',
57
+ alignItems: 'center',
58
+ height: 75,
59
+ width: 158,
60
+ borderRadius: 10,
61
+ marginLeft: 12,
62
+ marginVertical: 14,
63
+ },
64
+ iconContainer: {
65
+ marginHorizontal: 16,
66
+ },
67
+ textContainer: {
68
+ flex: 1,
69
+ position: 'absolute',
70
+ padding: 10,
71
+ bottom: 0,
72
+ marginHorizontal: 8,
73
+ marginTop: 20,
74
+ },
75
+ titleText: {
76
+ marginBottom: 4,
77
+ },
78
+ rightIconContainer: {
79
+ position: 'absolute',
80
+ right: 10,
81
+ top: 10,
82
+ },
83
+ });
84
+
85
+ export default withThemeProvider(Topic);
@@ -0,0 +1 @@
1
+ export {default} from './Topic';
package/src/index.ts CHANGED
@@ -25,4 +25,8 @@ export {default as SwipableList} from './components/swipableList';
25
25
  export {default as CustomTypography} from './components/customTypography';
26
26
  export {default as CustomIcon} from './components/customIcon';
27
27
  export {default as CustomLoader} from './components/customLoader';
28
+ export {default as Line} from './components/horizontalLine';
29
+ export {default as Topic} from './components/topic';
30
+ export {default as ContactModel} from './components/ContactModel';
31
+
28
32
  export * from './utils/stylehelper';