ordering-ui-react-native 0.15.41 → 0.15.42
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 +1 -1
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +26 -4
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +20 -1
- package/themes/original/src/components/BusinessProductsList/styles.tsx +20 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +39 -18
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/utils/index.tsx +9 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { OIcon, OText, OModal } from '../shared';
|
|
6
6
|
import { BusinessBasicInformationParams } from '../../types';
|
|
7
|
-
import { convertHoursToMinutes } from '../../utils';
|
|
7
|
+
import { convertHoursToMinutes, shape } from '../../utils';
|
|
8
8
|
import { BusinessInformation } from '../BusinessInformation';
|
|
9
9
|
import { BusinessReviews } from '../BusinessReviews';
|
|
10
10
|
import dayjs from 'dayjs';
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
BusinessInfoItem,
|
|
23
23
|
WrapReviews,
|
|
24
24
|
WrapBusinessInfo,
|
|
25
|
+
TitleWrapper,
|
|
26
|
+
RibbonBox
|
|
25
27
|
} from './styles';
|
|
26
28
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
27
29
|
const types = ['food', 'laundry', 'alcohol', 'groceries'];
|
|
@@ -121,9 +123,29 @@ export const BusinessBasicInformation = (
|
|
|
121
123
|
<PlaceholderLine height={30} width={20} />
|
|
122
124
|
</Placeholder>
|
|
123
125
|
) : (
|
|
124
|
-
<
|
|
125
|
-
{
|
|
126
|
-
|
|
126
|
+
<TitleWrapper>
|
|
127
|
+
<OText size={24} weight={'600'}>
|
|
128
|
+
{business?.name}
|
|
129
|
+
</OText>
|
|
130
|
+
{business?.ribbon?.enabled && (
|
|
131
|
+
<RibbonBox
|
|
132
|
+
bgColor={business?.ribbon?.color}
|
|
133
|
+
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
134
|
+
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
135
|
+
>
|
|
136
|
+
<OText
|
|
137
|
+
size={10}
|
|
138
|
+
weight={'400'}
|
|
139
|
+
color={theme.colors.white}
|
|
140
|
+
numberOfLines={2}
|
|
141
|
+
ellipsizeMode='tail'
|
|
142
|
+
lineHeight={13}
|
|
143
|
+
>
|
|
144
|
+
{business?.ribbon?.text}
|
|
145
|
+
</OText>
|
|
146
|
+
</RibbonBox>
|
|
147
|
+
)}
|
|
148
|
+
</TitleWrapper>
|
|
127
149
|
)}
|
|
128
150
|
</BusinessInfoItem>
|
|
129
151
|
{loading ? (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export const BusinessContainer = styled.View`
|
|
@@ -41,3 +41,30 @@ export const WrapBusinessInfo = styled.TouchableOpacity`
|
|
|
41
41
|
top: 16px;
|
|
42
42
|
end: 39px;
|
|
43
43
|
`;
|
|
44
|
+
|
|
45
|
+
export const TitleWrapper = styled.View`
|
|
46
|
+
width: 100%;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
`
|
|
51
|
+
|
|
52
|
+
export const RibbonBox = styled.View`
|
|
53
|
+
margin-left: 5px;
|
|
54
|
+
background-color: ${(props: any) => props.theme.colors.primary};
|
|
55
|
+
padding: 2px 8px;
|
|
56
|
+
max-width: 180px;
|
|
57
|
+
align-self: flex-start;
|
|
58
|
+
|
|
59
|
+
${(props: any) => props.bgColor && css`
|
|
60
|
+
background-color: ${props.bgColor};
|
|
61
|
+
`}
|
|
62
|
+
|
|
63
|
+
${(props: any) => props.isRoundRect && css`
|
|
64
|
+
border-radius: 7.6px;
|
|
65
|
+
`}
|
|
66
|
+
|
|
67
|
+
${(props: any) => props.isCapsule && css`
|
|
68
|
+
border-radius: 50px;
|
|
69
|
+
`}
|
|
70
|
+
`
|
|
@@ -4,11 +4,12 @@ import { SingleProductCard } from '../SingleProductCard';
|
|
|
4
4
|
import { NotFoundSource } from '../NotFoundSource';
|
|
5
5
|
import { BusinessProductsListParams } from '../../types';
|
|
6
6
|
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
7
|
-
import { ProductsContainer, ErrorMessage, WrapperNotFound } from './styles';
|
|
7
|
+
import { ProductsContainer, ErrorMessage, WrapperNotFound, RibbonBox } from './styles';
|
|
8
8
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
9
9
|
import { View, ScrollView } from 'react-native';
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
|
+
import { shape } from '../../utils'
|
|
12
13
|
|
|
13
14
|
const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
14
15
|
const {
|
|
@@ -110,6 +111,24 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
110
111
|
<OText size={16} weight="600">
|
|
111
112
|
{category.name}
|
|
112
113
|
</OText>
|
|
114
|
+
{category?.ribbon?.enabled && (
|
|
115
|
+
<RibbonBox
|
|
116
|
+
bgColor={category?.ribbon?.color}
|
|
117
|
+
isRoundRect={category?.ribbon?.shape === shape?.rectangleRound}
|
|
118
|
+
isCapsule={category?.ribbon?.shape === shape?.capsuleShape}
|
|
119
|
+
>
|
|
120
|
+
<OText
|
|
121
|
+
size={10}
|
|
122
|
+
weight={'400'}
|
|
123
|
+
color={theme.colors.white}
|
|
124
|
+
numberOfLines={2}
|
|
125
|
+
ellipsizeMode='tail'
|
|
126
|
+
lineHeight={13}
|
|
127
|
+
>
|
|
128
|
+
{category?.ribbon?.text}
|
|
129
|
+
</OText>
|
|
130
|
+
</RibbonBox>
|
|
131
|
+
)}
|
|
113
132
|
</View>
|
|
114
133
|
{!!category?.description && (
|
|
115
134
|
<View style={{ position: 'relative' }}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const ProductsContainer = styled.View`
|
|
4
4
|
`
|
|
@@ -11,4 +11,23 @@ export const ErrorMessage = styled.View`
|
|
|
11
11
|
|
|
12
12
|
export const WrapperNotFound = styled.View`
|
|
13
13
|
height: 500px;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const RibbonBox = styled.View`
|
|
17
|
+
margin-left: 5px;
|
|
18
|
+
background-color: ${(props: any) => props.theme.colors.primary};
|
|
19
|
+
padding: 2px 8px;
|
|
20
|
+
max-width: 180px;
|
|
21
|
+
|
|
22
|
+
${(props: any) => props.bgColor && css`
|
|
23
|
+
background-color: ${props.bgColor};
|
|
24
|
+
`}
|
|
25
|
+
|
|
26
|
+
${(props: any) => props.isRoundRect && css`
|
|
27
|
+
border-radius: 7.6px;
|
|
28
|
+
`}
|
|
29
|
+
|
|
30
|
+
${(props: any) => props.isCapsule && css`
|
|
31
|
+
border-radius: 50px;
|
|
32
|
+
`}
|
|
14
33
|
`
|
|
@@ -7,10 +7,11 @@ import {
|
|
|
7
7
|
} from 'ordering-components/native';
|
|
8
8
|
import { useTheme } from 'styled-components/native';
|
|
9
9
|
import { SingleProductCardParams } from '../../types';
|
|
10
|
-
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
|
|
10
|
+
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
|
|
11
11
|
import { StyleSheet } from 'react-native';
|
|
12
12
|
import { OText, OIcon } from '../shared';
|
|
13
13
|
import FastImage from 'react-native-fast-image'
|
|
14
|
+
import { shape } from '../../utils';
|
|
14
15
|
|
|
15
16
|
export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
16
17
|
const {
|
|
@@ -46,8 +47,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
46
47
|
productStyle: {
|
|
47
48
|
width: 75,
|
|
48
49
|
height: 75,
|
|
49
|
-
borderRadius: 7.6
|
|
50
|
-
marginStart: 12
|
|
50
|
+
borderRadius: 7.6
|
|
51
51
|
},
|
|
52
52
|
quantityContainer: {
|
|
53
53
|
position: 'absolute',
|
|
@@ -136,21 +136,42 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
136
136
|
{product?.description}
|
|
137
137
|
</OText>
|
|
138
138
|
</CardInfo>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
139
|
+
<LogoWrapper>
|
|
140
|
+
{product?.ribbon?.enabled && (
|
|
141
|
+
<RibbonBox
|
|
142
|
+
bgColor={product?.ribbon?.color}
|
|
143
|
+
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
144
|
+
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
145
|
+
>
|
|
146
|
+
<OText
|
|
147
|
+
size={10}
|
|
148
|
+
weight={'400'}
|
|
149
|
+
color={theme.colors.white}
|
|
150
|
+
numberOfLines={2}
|
|
151
|
+
ellipsizeMode='tail'
|
|
152
|
+
lineHeight={13}
|
|
153
|
+
>
|
|
154
|
+
{product?.ribbon?.text}
|
|
155
|
+
</OText>
|
|
156
|
+
</RibbonBox>
|
|
157
|
+
)}
|
|
158
|
+
{product?.images ? (
|
|
159
|
+
<FastImage
|
|
160
|
+
style={styles.productStyle}
|
|
161
|
+
source={{
|
|
162
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
163
|
+
priority: FastImage.priority.normal,
|
|
164
|
+
}}
|
|
165
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
166
|
+
/>
|
|
167
|
+
) : (
|
|
168
|
+
<OIcon
|
|
169
|
+
src={theme?.images?.dummies?.product}
|
|
170
|
+
style={styles.productStyle}
|
|
171
|
+
/>
|
|
172
|
+
)}
|
|
173
|
+
</LogoWrapper>
|
|
174
|
+
|
|
154
175
|
{(isSoldOut || maxProductQuantity <= 0) && (
|
|
155
176
|
<SoldOut>
|
|
156
177
|
<OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const CardContainer = styled.TouchableOpacity`
|
|
4
4
|
flex: 1;
|
|
@@ -31,3 +31,30 @@ export const PricesContainer = styled.View`
|
|
|
31
31
|
flex-direction: row;
|
|
32
32
|
align-items: center;
|
|
33
33
|
`
|
|
34
|
+
|
|
35
|
+
export const LogoWrapper = styled.View`
|
|
36
|
+
position: relative;
|
|
37
|
+
margin-left: 12px;
|
|
38
|
+
`
|
|
39
|
+
|
|
40
|
+
export const RibbonBox = styled.View`
|
|
41
|
+
position: absolute;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
top: -4px;
|
|
44
|
+
right: -4px;
|
|
45
|
+
background-color: ${(props: any) => props.theme.colors.primary};
|
|
46
|
+
padding: 1px 8px;
|
|
47
|
+
max-width: 60px;
|
|
48
|
+
|
|
49
|
+
${(props: any) => props.bgColor && css`
|
|
50
|
+
background-color: ${props.bgColor};
|
|
51
|
+
`}
|
|
52
|
+
|
|
53
|
+
${(props: any) => props.isRoundRect && css`
|
|
54
|
+
border-radius: 7.6px;
|
|
55
|
+
`}
|
|
56
|
+
|
|
57
|
+
${(props: any) => props.isCapsule && css`
|
|
58
|
+
border-radius: 50px;
|
|
59
|
+
`}
|
|
60
|
+
`
|
|
@@ -170,6 +170,15 @@ export const getTypesText = (value: number) => {
|
|
|
170
170
|
return ret?.content;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* List shape for ribbon
|
|
175
|
+
*/
|
|
176
|
+
export const shape = {
|
|
177
|
+
rectangle: 'rectangle',
|
|
178
|
+
rectangleRound: 'rectangle_round',
|
|
179
|
+
capsuleShape: 'capsule_shape'
|
|
180
|
+
}
|
|
181
|
+
|
|
173
182
|
/**
|
|
174
183
|
* Function to transform degree to radian
|
|
175
184
|
* @param {number} value for transform
|