ordering-ui-react-native 0.11.24 → 0.11.28

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.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/src/components/BusinessTypeFilter/index.tsx +155 -105
  3. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -2
  4. package/themes/business/src/components/OrdersOption/index.tsx +4 -4
  5. package/themes/business/src/types/index.tsx +6 -0
  6. package/themes/doordash/src/components/BusinessTypeFilter/index.tsx +152 -84
  7. package/themes/doordash/src/components/BusinessTypeFilter/styles.tsx +1 -2
  8. package/themes/kiosk/src/components/BusinessMenu/index.tsx +5 -6
  9. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +6 -14
  10. package/themes/kiosk/src/components/Cart/index.tsx +75 -60
  11. package/themes/kiosk/src/components/Cart/styles.tsx +19 -1
  12. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +5 -2
  13. package/themes/kiosk/src/components/CartItem/index.tsx +144 -57
  14. package/themes/kiosk/src/components/CartItem/styles.tsx +24 -0
  15. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +9 -18
  16. package/themes/kiosk/src/components/LoginForm/index.tsx +1 -8
  17. package/themes/kiosk/src/components/OrderDetails/index.tsx +132 -82
  18. package/themes/kiosk/src/components/OrderDetails/styles.tsx +22 -1
  19. package/themes/kiosk/src/components/PaymentOptions/index.tsx +2 -1
  20. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -2
  21. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  22. package/themes/kiosk/src/components/ProductOption/styles.tsx +2 -2
  23. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +56 -52
  24. package/themes/kiosk/src/components/ProductOptionSubOption/styles.tsx +10 -0
  25. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +41 -38
  26. package/themes/kiosk/src/components/shared/OCard.tsx +1 -1
  27. package/themes/kiosk/src/components/shared/OInput.tsx +4 -0
  28. package/themes/kiosk/src/types/index.d.ts +3 -0
  29. package/themes/original/src/components/BusinessTypeFilter/index.tsx +118 -44
  30. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +4 -4
  31. package/themes/original/src/components/BusinessesListing/index.tsx +3 -0
  32. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +122 -0
  33. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +7 -0
  34. package/themes/original/src/types/index.tsx +4 -0
  35. package/themes/uber-eats/src/components/BusinessTypeFilter/index.tsx +151 -76
  36. package/themes/uber-eats/src/components/BusinessTypeFilter/styles.tsx +0 -9
@@ -1,13 +1,15 @@
1
- import React from 'react'
2
- import { StyleSheet, FlatList, View, ScrollView, TouchableOpacity } from 'react-native'
1
+ import React, { useState } from 'react'
2
+ import { StyleSheet, View, ScrollView, TouchableOpacity, Dimensions } from 'react-native'
3
3
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
4
  import { BusinessTypeFilter as BusinessTypeFilterController, useLanguage } from 'ordering-components/native'
5
+ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
5
6
 
6
- import { BusinessCategories, Category, BCContainer } from './styles'
7
- import { OIcon, OText } from '../shared'
7
+ import { BusinessCategories, BCContainer } from './styles'
8
+ import { OIcon, OText, OModal } from '../shared'
8
9
  import { BusinessTypeFilterParams } from '../../types'
9
10
  import { useTheme } from 'styled-components/native'
10
11
 
12
+ const windowWidth = Dimensions.get('window').width;
11
13
 
12
14
  export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
13
15
  const {
@@ -18,92 +20,165 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
18
20
 
19
21
  const theme = useTheme()
20
22
  const [, t] = useLanguage();
23
+ const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
21
24
 
22
- const renderTypes = ({ item }: any) => {
25
+
26
+ const styles = StyleSheet.create({
27
+ icons: {
28
+ padding: 10
29
+ },
30
+ logo: {
31
+ width: isOpenAllCategories ? windowWidth / 3 - 27 : windowWidth / 4 - 20,
32
+ height: isOpenAllCategories ? windowWidth / 3 - 27 : windowWidth / 4 - 20,
33
+ marginBottom: 15,
34
+ borderRadius: 8,
35
+ justifyContent: 'center',
36
+ alignItems: 'center',
37
+ },
38
+ categoryStyle: {
39
+ width: isOpenAllCategories ? windowWidth / 3 - 27 : windowWidth / 4 - 20,
40
+ height: 150,
41
+ flexDirection: 'column',
42
+ justifyContent: 'center',
43
+ alignItems: 'center',
44
+ marginHorizontal: isOpenAllCategories ? 10 : 0,
45
+ marginBottom: isOpenAllCategories ? 40 : 0
46
+ },
47
+ allCategoriesContainer : {
48
+ paddingHorizontal: 10,
49
+ paddingVertical: 30
50
+ },
51
+ allCategoriesWrapper: {
52
+ flexDirection: 'row',
53
+ flexWrap: 'wrap',
54
+ }
55
+ })
56
+
57
+ const RenderTypes = ({ item }: any ) => {
23
58
  return (
24
59
  <TouchableOpacity
25
- key={item.id}
26
- onPress={() => handleChangeBusinessType(item.id)}
60
+ style={styles.categoryStyle}
61
+ onPress={() => {
62
+ handleChangeBusinessType(item.id)
63
+ isOpenAllCategories && setIsOpenAllCategories(false)
64
+ }}
27
65
  >
28
- <Category>
29
- {item.image ? (
30
- <OIcon
31
- url={item.image}
32
- style={styles.logo}
33
- />
34
- ) : (
35
- <OIcon
36
- src={theme.images.categories.all}
37
- style={styles.logo}
38
- />
39
- )}
40
- <OText
41
- style={{ textAlign: 'center' }}
42
- size={14}
43
- color={currentTypeSelected === item.id ? theme.colors.primary : theme.colors.textSecondary}
44
- >
45
- {t(`BUSINESS_TYPE_${item.name.replace(/\s/g, '_').toUpperCase()}`, item.name)}
46
- </OText>
47
- </Category>
66
+ {item.image ? (
67
+ <OIcon
68
+ url={item.image}
69
+ style={styles.logo}
70
+ />
71
+ ) : (
72
+ <OIcon
73
+ src={theme.images.categories.all}
74
+ style={styles.logo}
75
+ />
76
+ )}
77
+ <OText
78
+ style={{ textAlign: 'center' }}
79
+ size={14}
80
+ color={currentTypeSelected === item.id ? theme.colors.primary : theme.colors.textSecondary}
81
+ numberOfLines={1}
82
+ ellipsizeMode='tail'
83
+ >
84
+ {t(`BUSINESS_TYPE_${item.name.replace(/\s/g, '_').toUpperCase()}`, item.name)}
85
+ </OText>
48
86
  </TouchableOpacity>
49
87
  )
50
88
  }
51
89
 
52
90
  return (
53
- <BCContainer>
54
- {typesState?.loading && (
55
- <View>
56
- <Placeholder
57
- style={{ marginVertical: 10 }}
58
- Animation={Fade}
59
- >
60
- <ScrollView
61
- horizontal
62
- showsVerticalScrollIndicator={false}
63
- showsHorizontalScrollIndicator={false}
91
+ <>
92
+ <BCContainer>
93
+ {typesState?.loading && (
94
+ <View>
95
+ <Placeholder
96
+ style={{ marginVertical: 10 }}
97
+ Animation={Fade}
64
98
  >
65
- {[...Array(4)].map((_, i) => (
66
- <View key={i} style={{ width: 80, borderRadius: 10, marginRight: 15 }}>
67
- <PlaceholderLine
68
- height={80}
69
- noMargin
70
- />
71
- </View>
99
+ <ScrollView
100
+ horizontal
101
+ showsVerticalScrollIndicator={false}
102
+ showsHorizontalScrollIndicator={false}
103
+ >
104
+ {[...Array(4)].map((_, i) => (
105
+ <View key={i} style={{ width: 80, borderRadius: 8, marginRight: 15 }}>
106
+ <PlaceholderLine
107
+ height={80}
108
+ noMargin
109
+ />
110
+ </View>
111
+ ))}
112
+ </ScrollView>
113
+ </Placeholder>
114
+ </View>
115
+ )}
116
+ {!typesState?.loading && !typesState?.error && typesState?.types && typesState?.types.length > 0 && (
117
+ <>
118
+ <BusinessCategories>
119
+ {typesState?.types.slice(0, 3).map((type: any) => (
120
+ <RenderTypes
121
+ key={type.id}
122
+ item={type}
123
+ />
72
124
  ))}
73
- </ScrollView>
74
- </Placeholder>
75
- </View>
76
- )}
77
- {!typesState?.loading && !typesState?.error && typesState?.types && typesState?.types.length > 0 && (
78
- <>
79
- <BusinessCategories>
80
- <FlatList
81
- horizontal
82
- showsHorizontalScrollIndicator={false}
83
- data={typesState?.types}
84
- renderItem={renderTypes}
85
- keyExtractor={type => type.name}
86
- />
87
- </BusinessCategories>
88
- </>
89
- )}
90
- </BCContainer>
125
+ {typesState?.types.length > 3 && (
126
+ <TouchableOpacity
127
+ style={styles.categoryStyle}
128
+ onPress={() => setIsOpenAllCategories(true)}
129
+ >
130
+ <View
131
+ style={{ ...styles.logo, backgroundColor: theme.colors.lightGray }}
132
+ >
133
+ <MaterialIcon
134
+ name='dots-horizontal'
135
+ size={32}
136
+ color={theme.colors.black}
137
+ />
138
+ </View>
139
+ <OText
140
+ style={{ textAlign: 'center' }}
141
+ size={14}
142
+ color={theme.colors.textSecondary}
143
+ numberOfLines={1}
144
+ ellipsizeMode='tail'
145
+ >
146
+ {t('SEE_ALL', 'See all')}
147
+ </OText>
148
+ </TouchableOpacity>
149
+ )}
150
+ </BusinessCategories>
151
+ </>
152
+ )}
153
+ </BCContainer>
154
+ <OModal
155
+ open={isOpenAllCategories}
156
+ onClose={() => setIsOpenAllCategories(false)}
157
+ entireModal
158
+ >
159
+ <ScrollView style={styles.allCategoriesContainer}>
160
+ <OText
161
+ size={20}
162
+ mBottom={30}
163
+ color={theme.colors.textSecondary}
164
+ style={{ paddingHorizontal: 10 }}
165
+ >
166
+ {t('ALL_CATEGORIES', 'All categories')}
167
+ </OText>
168
+ <View style={styles.allCategoriesWrapper}>
169
+ {typesState?.types.map((type: any) => (
170
+ <RenderTypes
171
+ key={type.id}
172
+ item={type}
173
+ />
174
+ ))}
175
+ </View>
176
+ </ScrollView>
177
+ </OModal>
178
+ </>
91
179
  )
92
180
  }
93
181
 
94
- const styles = StyleSheet.create({
95
- icons: {
96
- padding: 10
97
- },
98
- logo: {
99
- width: 50,
100
- height: 50,
101
- marginBottom: 15,
102
- justifyContent: 'center',
103
- alignItems: 'center',
104
- },
105
- })
106
-
107
182
  export const BusinessTypeFilter = (props: BusinessTypeFilterParams) => {
108
183
  const businessTypeFilterProps = {
109
184
  ...props,
@@ -16,15 +16,6 @@ export const BusinessCategories = styled.View`
16
16
  margin: 10px 0px;
17
17
  width: 100%;
18
18
  `
19
- export const Category = styled.View`
20
- height: 100px;
21
- min-width: 70px;
22
- margin-right: 15px;
23
- display: flex;
24
- flex-direction: column;
25
- justify-content: center;
26
- align-items: center;
27
- `
28
19
 
29
20
  export const IconContainer = styled.View`
30
21
  border-width: 1px;