ordering-ui-external 1.7.2 → 1.8.1
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/_bundles/{0.ordering-ui.f9c3deec77a8e21645ed.js → 0.ordering-ui.cf9ba81c5417ae8af84a.js} +1 -1
- package/_bundles/{1.ordering-ui.f9c3deec77a8e21645ed.js → 1.ordering-ui.cf9ba81c5417ae8af84a.js} +1 -1
- package/_bundles/2.ordering-ui.cf9ba81c5417ae8af84a.js +1 -0
- package/_bundles/{4.ordering-ui.f9c3deec77a8e21645ed.js → 4.ordering-ui.cf9ba81c5417ae8af84a.js} +1 -1
- package/_bundles/{5.ordering-ui.f9c3deec77a8e21645ed.js → 5.ordering-ui.cf9ba81c5417ae8af84a.js} +1 -1
- package/_bundles/{6.ordering-ui.f9c3deec77a8e21645ed.js → 6.ordering-ui.cf9ba81c5417ae8af84a.js} +1 -1
- package/_bundles/{7.ordering-ui.f9c3deec77a8e21645ed.js → 7.ordering-ui.cf9ba81c5417ae8af84a.js} +2 -2
- package/_bundles/{7.ordering-ui.f9c3deec77a8e21645ed.js.LICENSE.txt → 7.ordering-ui.cf9ba81c5417ae8af84a.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.f9c3deec77a8e21645ed.js → 8.ordering-ui.cf9ba81c5417ae8af84a.js} +1 -1
- package/_bundles/{9.ordering-ui.f9c3deec77a8e21645ed.js → 9.ordering-ui.cf9ba81c5417ae8af84a.js} +1 -1
- package/_bundles/ordering-ui.cf9ba81c5417ae8af84a.js +2 -0
- package/_bundles/{ordering-ui.f9c3deec77a8e21645ed.js.LICENSE.txt → ordering-ui.cf9ba81c5417ae8af84a.js.LICENSE.txt} +0 -0
- package/_modules/components/BusinessInformation/index.js +4 -8
- package/_modules/components/OrdersOption/styles.js +4 -2
- package/_modules/components/Pagination/index.js +100 -0
- package/_modules/components/Pagination/styles.js +56 -0
- package/_modules/components/SmartAppBanner/index.js +2 -1
- package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +92 -0
- package/_modules/components/VerticalOrdersLayout/index.js +115 -41
- package/_modules/components/VerticalOrdersLayout/styles.js +25 -11
- package/_modules/index.js +7 -0
- package/_modules/themes/five/src/components/AccordionDropdown/index.js +15 -4
- package/_modules/themes/five/src/components/AccordionDropdown/styles.js +14 -4
- package/_modules/themes/five/src/components/AddressList/styles.js +2 -2
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +17 -10
- package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +48 -42
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +5 -1
- package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +0 -3
- package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/index.js +22 -13
- package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +15 -7
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +3 -0
- package/_modules/themes/five/src/components/BusinessTypeFilter/index.js +15 -5
- package/_modules/themes/five/src/components/BusinessesListing/index.js +6 -13
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +66 -40
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +13 -7
- package/_modules/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/index.js +16 -7
- package/_modules/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/styles.js +21 -15
- package/_modules/themes/five/src/components/CardForm/index.js +17 -3
- package/_modules/themes/five/src/components/CardForm/styles.js +14 -6
- package/_modules/themes/five/src/components/CartPopover/index.js +6 -4
- package/_modules/themes/five/src/components/CartPopover/styles.js +4 -2
- package/_modules/themes/five/src/components/Footer/index.js +16 -6
- package/_modules/themes/five/src/components/Footer/styles.js +11 -9
- package/_modules/themes/five/src/components/Header/index.js +14 -9
- package/_modules/themes/five/src/components/Header/styles.js +64 -44
- package/_modules/themes/five/src/components/HeaderOption/index.js +9 -2
- package/_modules/themes/five/src/components/HeaderOption/styles.js +8 -2
- package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +9 -3
- package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +5 -3
- package/_modules/themes/five/src/components/HorizontalOrdersLayout/index.js +9 -19
- package/_modules/themes/five/src/components/HorizontalOrdersLayout/styles.js +23 -19
- package/_modules/themes/five/src/components/InputPhoneNumber/index.js +1 -0
- package/_modules/themes/five/src/components/LoginForm/index.js +3 -2
- package/_modules/themes/five/src/components/MyOrders/index.js +24 -56
- package/_modules/themes/five/src/components/MyOrders/styles.js +1 -1
- package/_modules/themes/five/src/components/OrderDetails/index.js +5 -2
- package/_modules/themes/five/src/components/OrderDetails/styles.js +24 -24
- package/_modules/themes/five/src/components/OrderItAgain/styles.js +6 -2
- package/_modules/themes/five/src/components/OrdersOption/index.js +18 -18
- package/_modules/themes/five/src/components/OrdersOption/styles.js +2 -2
- package/_modules/themes/five/src/components/PageBanner/index.js +50 -0
- package/_modules/themes/five/src/components/PageBanner/styles.js +18 -0
- package/_modules/themes/five/src/components/Pagination/index.js +99 -0
- package/_modules/themes/five/src/components/Pagination/styles.js +56 -0
- package/_modules/themes/five/src/components/ProductForm/index.js +39 -23
- package/_modules/themes/five/src/components/ProductForm/styles.js +74 -38
- package/_modules/themes/five/src/components/Promotions/index.js +7 -2
- package/_modules/themes/five/src/components/Promotions/styles.js +16 -14
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +31 -10
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +19 -11
- package/_modules/themes/five/src/components/SidebarMenu/styles.js +1 -1
- package/_modules/themes/five/src/components/SignUpForm/index.js +3 -2
- package/_modules/themes/five/src/components/SingleOrderCard/index.js +7 -17
- package/_modules/themes/five/src/components/SingleProductCard/index.js +7 -298
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +310 -0
- package/_modules/themes/five/src/components/SingleProductCard/{styles.js → layouts/original/styles.js} +37 -33
- package/_modules/themes/five/src/components/SingleProductCard/layouts/starbucks/index.js +305 -0
- package/_modules/themes/five/src/components/SingleProductCard/layouts/starbucks/styles.js +143 -0
- package/_modules/themes/five/src/components/StripeElementsForm/index.js +1 -0
- package/_modules/themes/five/src/components/UserPopover/index.js +3 -1
- package/_modules/themes/five/src/components/UserPopover/styles.js +4 -3
- package/_modules/themes/five/src/components/UserProfileForm/styles.js +5 -8
- package/_modules/themes/six/src/components/BusinessController/index.js +81 -15
- package/_modules/themes/six/src/components/BusinessController/styles.js +58 -30
- package/_modules/themes/six/src/components/BusinessProductsListing/SearchProducts/index.js +5 -3
- package/_modules/themes/six/src/components/BusinessesMap/styles.js +1 -1
- package/_modules/themes/six/src/components/SearchBar/index.js +19 -10
- package/_modules/themes/six/src/components/SearchBar/styles.js +44 -16
- package/index-template.js +3 -1
- package/package.json +2 -2
- package/src/components/BusinessInformation/index.js +3 -8
- package/src/components/OrdersOption/styles.js +5 -5
- package/src/components/Pagination/index.js +107 -0
- package/src/components/Pagination/styles.js +106 -0
- package/src/components/SmartAppBanner/index.js +1 -0
- package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +89 -0
- package/src/components/VerticalOrdersLayout/index.js +86 -48
- package/src/components/VerticalOrdersLayout/styles.js +66 -22
- package/src/index.js +2 -0
- package/src/themes/five/src/components/AccordionDropdown/index.js +19 -6
- package/src/themes/five/src/components/AccordionDropdown/styles.js +25 -1
- package/src/themes/five/src/components/AddressList/styles.js +2 -0
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +21 -11
- package/src/themes/five/src/components/BusinessBasicInformation/styles.js +9 -3
- package/src/themes/five/src/components/BusinessListingSearch/index.js +1 -0
- package/src/themes/five/src/components/BusinessProductsCategories/index.js +0 -2
- package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/index.js +23 -12
- package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +12 -4
- package/src/themes/five/src/components/BusinessProductsListing/index.js +3 -0
- package/src/themes/five/src/components/BusinessTypeFilter/index.js +15 -5
- package/src/themes/five/src/components/BusinessesListing/index.js +5 -5
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +54 -25
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +40 -26
- package/src/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/index.js +19 -6
- package/src/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/styles.js +38 -3
- package/src/themes/five/src/components/CardForm/index.js +49 -8
- package/src/themes/five/src/components/CardForm/styles.js +20 -2
- package/src/themes/five/src/components/CartPopover/index.js +2 -1
- package/src/themes/five/src/components/CartPopover/styles.js +3 -3
- package/src/themes/five/src/components/Footer/index.js +15 -6
- package/src/themes/five/src/components/Footer/styles.js +15 -14
- package/src/themes/five/src/components/Header/index.js +6 -4
- package/src/themes/five/src/components/Header/styles.js +14 -11
- package/src/themes/five/src/components/HeaderOption/index.js +13 -10
- package/src/themes/five/src/components/HeaderOption/styles.js +2 -2
- package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +22 -10
- package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +8 -0
- package/src/themes/five/src/components/HorizontalOrdersLayout/index.js +24 -36
- package/src/themes/five/src/components/HorizontalOrdersLayout/styles.js +12 -1
- package/src/themes/five/src/components/InputPhoneNumber/index.js +1 -0
- package/src/themes/five/src/components/LoginForm/index.js +2 -1
- package/src/themes/five/src/components/MyOrders/index.js +20 -62
- package/src/themes/five/src/components/MyOrders/styles.js +1 -2
- package/src/themes/five/src/components/OrderDetails/index.js +9 -0
- package/src/themes/five/src/components/OrderDetails/styles.js +0 -55
- package/src/themes/five/src/components/OrderItAgain/styles.js +18 -0
- package/src/themes/five/src/components/OrdersOption/index.js +10 -16
- package/src/themes/five/src/components/OrdersOption/styles.js +1 -3
- package/src/themes/five/src/components/PageBanner/index.js +58 -0
- package/src/themes/five/src/components/PageBanner/styles.js +58 -0
- package/src/themes/five/src/components/Pagination/index.js +106 -0
- package/src/themes/five/src/components/Pagination/styles.js +106 -0
- package/src/themes/five/src/components/ProductForm/index.js +108 -84
- package/src/themes/five/src/components/ProductForm/styles.js +94 -12
- package/src/themes/five/src/components/Promotions/index.js +22 -16
- package/src/themes/five/src/components/Promotions/styles.js +10 -4
- package/src/themes/five/src/components/RenderProductsLayout/index.js +94 -66
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +23 -22
- package/src/themes/five/src/components/SidebarMenu/styles.js +1 -1
- package/src/themes/five/src/components/SignUpForm/index.js +2 -1
- package/src/themes/five/src/components/SingleOrderCard/index.js +0 -21
- package/src/themes/five/src/components/SingleProductCard/index.js +7 -300
- package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +312 -0
- package/src/themes/five/src/components/SingleProductCard/{styles.js → layouts/original/styles.js} +9 -6
- package/src/themes/five/src/components/SingleProductCard/layouts/starbucks/index.js +313 -0
- package/src/themes/five/src/components/SingleProductCard/layouts/starbucks/styles.js +353 -0
- package/src/themes/five/src/components/StripeElementsForm/index.js +1 -0
- package/src/themes/five/src/components/UserPopover/index.js +2 -0
- package/src/themes/five/src/components/UserPopover/styles.js +2 -2
- package/src/themes/five/src/components/UserProfileForm/styles.js +3 -11
- package/src/themes/six/src/components/BusinessController/index.js +163 -62
- package/src/themes/six/src/components/BusinessController/styles.js +53 -14
- package/src/themes/six/src/components/BusinessProductsListing/SearchProducts/index.js +3 -1
- package/src/themes/six/src/components/BusinessesMap/styles.js +1 -1
- package/src/themes/six/src/components/SearchBar/index.js +27 -8
- package/src/themes/six/src/components/SearchBar/styles.js +33 -2
- package/template/app.js +364 -364
- package/template/assets/images/chew_logo.png +0 -0
- package/template/components/HelmetTags/index.js +5 -4
- package/_bundles/2.ordering-ui.f9c3deec77a8e21645ed.js +0 -1
- package/_bundles/ordering-ui.f9c3deec77a8e21645ed.js +0 -2
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useLanguage } from 'ordering-components-external'
|
|
3
|
+
import { ChevronLeft, ChevronRight } from 'react-bootstrap-icons'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
PaginationContainer,
|
|
7
|
+
PaginationButtonContainer,
|
|
8
|
+
PageButton,
|
|
9
|
+
} from './styles'
|
|
10
|
+
|
|
11
|
+
export const Pagination = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
currentPage,
|
|
14
|
+
totalPages,
|
|
15
|
+
handleChangePage,
|
|
16
|
+
} = props
|
|
17
|
+
|
|
18
|
+
const [, t] = useLanguage()
|
|
19
|
+
|
|
20
|
+
const [visiblePages, setVisiblePages] = useState([])
|
|
21
|
+
const [activePage, setActivePage] = useState(currentPage)
|
|
22
|
+
|
|
23
|
+
const filterPages = (visiblePages, totalPages) => {
|
|
24
|
+
return visiblePages.filter(page => page <= totalPages)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const getVisiblePages = (page, total) => {
|
|
28
|
+
if (total < 7) {
|
|
29
|
+
return filterPages([1, 2, 3, 4, 5, 6], total)
|
|
30
|
+
} else {
|
|
31
|
+
if (page % 5 >= 0 && page > 4 && page + 2 < total) {
|
|
32
|
+
return [1, page - 1, page, page + 1, total]
|
|
33
|
+
} else if (page % 5 >= 0 && page > 4 && page + 2 >= total) {
|
|
34
|
+
return [1, total - 3, total - 2, total - 1, total]
|
|
35
|
+
} else {
|
|
36
|
+
return [1, 2, 3, 4, 5, total]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const changePage = (page) => {
|
|
42
|
+
if (page === activePage) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
setActivePage(page)
|
|
46
|
+
const _visiblePages = getVisiblePages(page, totalPages)
|
|
47
|
+
setVisiblePages(filterPages(_visiblePages, totalPages))
|
|
48
|
+
handleChangePage(page)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!totalPages) return
|
|
53
|
+
setVisiblePages(getVisiblePages(null, totalPages))
|
|
54
|
+
}, [totalPages])
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
setActivePage(currentPage)
|
|
58
|
+
const _visiblePages = getVisiblePages(currentPage, totalPages)
|
|
59
|
+
setVisiblePages(filterPages(_visiblePages, totalPages))
|
|
60
|
+
}, [currentPage])
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<PaginationContainer>
|
|
64
|
+
<PaginationButtonContainer>
|
|
65
|
+
<PageButton
|
|
66
|
+
disabled={activePage === 1}
|
|
67
|
+
onClick={() => (activePage !== 1) && changePage(activePage - 1)}
|
|
68
|
+
>
|
|
69
|
+
<ChevronLeft />
|
|
70
|
+
</PageButton>
|
|
71
|
+
|
|
72
|
+
{visiblePages.map((page, index, array) => (
|
|
73
|
+
<React.Fragment key={page}>
|
|
74
|
+
{array[index - 1] + 2 <= page ? (
|
|
75
|
+
<>
|
|
76
|
+
<PageButton noEffect>
|
|
77
|
+
...
|
|
78
|
+
</PageButton>
|
|
79
|
+
<PageButton
|
|
80
|
+
active={activePage === page}
|
|
81
|
+
onClick={() => changePage(page)}
|
|
82
|
+
>
|
|
83
|
+
{page}
|
|
84
|
+
</PageButton>
|
|
85
|
+
</>
|
|
86
|
+
) : (
|
|
87
|
+
<PageButton
|
|
88
|
+
active={activePage === page}
|
|
89
|
+
onClick={() => changePage(page)}
|
|
90
|
+
>
|
|
91
|
+
{page}
|
|
92
|
+
</PageButton>
|
|
93
|
+
)}
|
|
94
|
+
</React.Fragment>
|
|
95
|
+
))}
|
|
96
|
+
|
|
97
|
+
<PageButton
|
|
98
|
+
disabled={activePage === totalPages}
|
|
99
|
+
onClick={() => (activePage !== totalPages) && changePage(activePage + 1)}
|
|
100
|
+
>
|
|
101
|
+
<ChevronRight />
|
|
102
|
+
</PageButton>
|
|
103
|
+
</PaginationButtonContainer>
|
|
104
|
+
</PaginationContainer>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import { darken } from 'polished'
|
|
3
|
+
|
|
4
|
+
export const PaginationContainer = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: flex-end;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const PaginationButtonContainer = styled.div`
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
${props => props.theme?.rtl ? css`
|
|
15
|
+
margin-left: 20px;
|
|
16
|
+
` : css`
|
|
17
|
+
margin-right: 20px;
|
|
18
|
+
`}
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
export const PageButton = styled.button`
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
color: ${props => props.theme.colors.headingColor};
|
|
25
|
+
outline: none;
|
|
26
|
+
border: none;
|
|
27
|
+
border-radius: 27px;
|
|
28
|
+
min-width: 27px;
|
|
29
|
+
min-height: 27px;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
padding: 0px 7px;
|
|
34
|
+
|
|
35
|
+
${props => props.theme?.rtl ? css`
|
|
36
|
+
margin-left: 3px;
|
|
37
|
+
` : css`
|
|
38
|
+
margin-right: 3px;
|
|
39
|
+
`}
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
background-color: #1507260a;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:disabled {
|
|
46
|
+
cursor: not-allowed;
|
|
47
|
+
opacity: 0.5;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:active {
|
|
51
|
+
background-color: #1507261a;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
${({ active }) => active && css`
|
|
55
|
+
background-color: ${props => props.theme.colors.primary};
|
|
56
|
+
color: ${props => props.theme.colors.primaryContrast};
|
|
57
|
+
&:hover {
|
|
58
|
+
background: ${props => darken(0.04, props.theme.colors.primary)};
|
|
59
|
+
}
|
|
60
|
+
&:active {
|
|
61
|
+
background: ${props => darken(0.1, props.theme.colors.primary)};
|
|
62
|
+
}
|
|
63
|
+
`}
|
|
64
|
+
|
|
65
|
+
${({ noEffect }) => noEffect && css`
|
|
66
|
+
cursor: initial;
|
|
67
|
+
&:hover {
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
}
|
|
70
|
+
&:active {
|
|
71
|
+
background-color: transparent;
|
|
72
|
+
}
|
|
73
|
+
`}
|
|
74
|
+
`
|
|
75
|
+
|
|
76
|
+
export const PageSizeContainer = styled.div`
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
margin: 10px 0;
|
|
80
|
+
|
|
81
|
+
.select {
|
|
82
|
+
border-color: ${props => props.theme.colors.lightGray};
|
|
83
|
+
padding: 5px 0;
|
|
84
|
+
|
|
85
|
+
> div:first-child {
|
|
86
|
+
padding-left: 10px;
|
|
87
|
+
padding-right: 10px;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`
|
|
91
|
+
|
|
92
|
+
export const PageSizeTitle = styled.p`
|
|
93
|
+
margin: 0px;
|
|
94
|
+
color: ${props => props.theme.colors.lightGray};
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
${props => props.theme?.rtl ? css`
|
|
97
|
+
margin-left: 10px;
|
|
98
|
+
` : css`
|
|
99
|
+
margin-right: 10px;
|
|
100
|
+
`}
|
|
101
|
+
`
|
|
102
|
+
|
|
103
|
+
export const Option = styled.div`
|
|
104
|
+
font-size: 14px;
|
|
105
|
+
color: ${props => props.theme.colors.lightGray};
|
|
106
|
+
`
|
|
@@ -4,6 +4,7 @@ import FiMinusCircle from '@meronex/icons/fi/FiMinusCircle'
|
|
|
4
4
|
import FiPlusCircle from '@meronex/icons/fi/FiPlusCircle'
|
|
5
5
|
import MdcPlayCircleOutline from '@meronex/icons/mdc/MdcPlayCircleOutline'
|
|
6
6
|
import { LinkableText } from '../LinkableText'
|
|
7
|
+
import { Heart as DisLike, HeartFill as Like } from 'react-bootstrap-icons'
|
|
7
8
|
import { AutoScroll } from '../AutoScroll'
|
|
8
9
|
|
|
9
10
|
import {
|
|
@@ -60,7 +61,8 @@ import {
|
|
|
60
61
|
WeightUnitItem,
|
|
61
62
|
ProductTagsListContainer,
|
|
62
63
|
ProductTagWrapper,
|
|
63
|
-
VideoGalleryWrapper
|
|
64
|
+
VideoGalleryWrapper,
|
|
65
|
+
TitleWrapper
|
|
64
66
|
} from './styles'
|
|
65
67
|
import { useTheme } from 'styled-components'
|
|
66
68
|
import { Input, TextArea } from '../../styles/Inputs'
|
|
@@ -92,7 +94,8 @@ const ProductOptionsUI = (props) => {
|
|
|
92
94
|
handleChangeIngredientState,
|
|
93
95
|
handleChangeSuboptionState,
|
|
94
96
|
handleChangeCommentState,
|
|
95
|
-
productAddedToCartLength
|
|
97
|
+
productAddedToCartLength,
|
|
98
|
+
handleFavoriteProduct
|
|
96
99
|
} = props
|
|
97
100
|
|
|
98
101
|
const { product, loading, error } = productObject
|
|
@@ -138,6 +141,15 @@ const ProductOptionsUI = (props) => {
|
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
|
|
144
|
+
const handleChangeFavorite = () => {
|
|
145
|
+
if (auth) {
|
|
146
|
+
handleFavoriteProduct && handleFavoriteProduct(product, !product?.favorite)
|
|
147
|
+
} else {
|
|
148
|
+
setModalPageToShow('login')
|
|
149
|
+
setModalIsOpen(true)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
141
153
|
const handleSaveProduct = () => {
|
|
142
154
|
const isErrors = Object.values(errors).length > 0
|
|
143
155
|
if (!isErrors) {
|
|
@@ -321,6 +333,7 @@ const ProductOptionsUI = (props) => {
|
|
|
321
333
|
setIsHaveWeight(true)
|
|
322
334
|
setPricePerWeightUnit(product?.price / product?.weight)
|
|
323
335
|
}
|
|
336
|
+
|
|
324
337
|
}, [product])
|
|
325
338
|
|
|
326
339
|
useEffect(() => {
|
|
@@ -360,15 +373,8 @@ const ProductOptionsUI = (props) => {
|
|
|
360
373
|
ref={productContainerRef}
|
|
361
374
|
useKioskApp={props.useKioskApp}
|
|
362
375
|
>
|
|
363
|
-
{loading && !error && (
|
|
364
|
-
<SkeletonBlock width={90}>
|
|
365
|
-
<Skeleton variant='rect' height={50} />
|
|
366
|
-
<Skeleton variant='rect' height={50} />
|
|
367
|
-
<Skeleton variant='rect' height={200} />
|
|
368
|
-
</SkeletonBlock>
|
|
369
|
-
)}
|
|
370
376
|
|
|
371
|
-
{product && !
|
|
377
|
+
{product && !error && (
|
|
372
378
|
<ProductShareWrapper>
|
|
373
379
|
{!props.useKioskApp ? (
|
|
374
380
|
<ProductShare
|
|
@@ -383,108 +389,126 @@ const ProductOptionsUI = (props) => {
|
|
|
383
389
|
)}
|
|
384
390
|
</ProductShareWrapper>
|
|
385
391
|
)}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
392
|
+
{product && (
|
|
393
|
+
<WrapperImage>
|
|
394
|
+
<SwiperWrapper isSoldOut={isSoldOut}>
|
|
395
|
+
<Swiper
|
|
396
|
+
spaceBetween={10}
|
|
397
|
+
navigation
|
|
398
|
+
watchOverflow
|
|
399
|
+
observer
|
|
400
|
+
observeParents
|
|
401
|
+
parallax
|
|
402
|
+
thumbs={{ swiper: thumbsSwiper }} className='mySwiper2'
|
|
403
|
+
onSlideChange={() => handleSlideChange()}
|
|
404
|
+
>
|
|
405
|
+
{gallery?.map((img, i) => (
|
|
406
|
+
<SwiperSlide key={i}>
|
|
407
|
+
<img src={img} alt='' className='active-img' />
|
|
408
|
+
</SwiperSlide>
|
|
409
|
+
))}
|
|
410
|
+
{videoGallery && videoGallery?.length > 0 && (
|
|
411
|
+
<>
|
|
412
|
+
{videoGallery?.map((video, j) => (
|
|
413
|
+
<SwiperSlide key={j}>
|
|
414
|
+
<iframe style={{ border: 'none', width: '100%', height: '100%' }} src={video} />
|
|
415
|
+
</SwiperSlide>
|
|
416
|
+
))}
|
|
417
|
+
</>
|
|
418
|
+
)}
|
|
419
|
+
</Swiper>
|
|
420
|
+
{galleryLength > 2 && (
|
|
391
421
|
<Swiper
|
|
392
|
-
|
|
393
|
-
|
|
422
|
+
onSwiper={setThumbsSwiper}
|
|
423
|
+
spaceBetween={20}
|
|
424
|
+
slidesPerView={5}
|
|
425
|
+
breakpoints={{
|
|
426
|
+
0: {
|
|
427
|
+
slidesPerView: 3,
|
|
428
|
+
spaceBetween: 20
|
|
429
|
+
},
|
|
430
|
+
300: {
|
|
431
|
+
slidesPerView: 4,
|
|
432
|
+
spaceBetween: 20
|
|
433
|
+
},
|
|
434
|
+
400: {
|
|
435
|
+
slidesPerView: 5,
|
|
436
|
+
spaceBetween: 20
|
|
437
|
+
},
|
|
438
|
+
550: {
|
|
439
|
+
slidesPerView: 6,
|
|
440
|
+
spaceBetween: 20
|
|
441
|
+
},
|
|
442
|
+
769: {
|
|
443
|
+
slidesPerView: 6,
|
|
444
|
+
spaceBetween: 20
|
|
445
|
+
}
|
|
446
|
+
}}
|
|
447
|
+
freeMode
|
|
448
|
+
watchSlidesProgress
|
|
449
|
+
className='product-thumb'
|
|
394
450
|
watchOverflow
|
|
395
451
|
observer
|
|
396
452
|
observeParents
|
|
397
453
|
parallax
|
|
398
|
-
thumbs={{ swiper: thumbsSwiper }} className='mySwiper2'
|
|
399
|
-
onSlideChange={() => handleSlideChange()}
|
|
400
454
|
>
|
|
401
|
-
{gallery
|
|
455
|
+
{gallery?.map((img, i) => (
|
|
402
456
|
<SwiperSlide key={i}>
|
|
403
457
|
<img src={img} alt='' />
|
|
404
458
|
</SwiperSlide>
|
|
405
459
|
))}
|
|
406
|
-
{videoGallery && videoGallery
|
|
460
|
+
{videoGallery && videoGallery?.length > 0 && (
|
|
407
461
|
<>
|
|
408
|
-
{videoGallery
|
|
462
|
+
{videoGallery?.map((video, j) => (
|
|
409
463
|
<SwiperSlide key={j}>
|
|
410
|
-
<
|
|
464
|
+
<VideoGalleryWrapper>
|
|
465
|
+
<img src={getOverFlowImage(video)} alt='' />
|
|
466
|
+
<MdcPlayCircleOutline />
|
|
467
|
+
</VideoGalleryWrapper>
|
|
411
468
|
</SwiperSlide>
|
|
412
469
|
))}
|
|
413
470
|
</>
|
|
414
471
|
)}
|
|
415
472
|
</Swiper>
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
},
|
|
430
|
-
400: {
|
|
431
|
-
slidesPerView: 5,
|
|
432
|
-
spaceBetween: 20
|
|
433
|
-
},
|
|
434
|
-
550: {
|
|
435
|
-
slidesPerView: 6,
|
|
436
|
-
spaceBetween: 20
|
|
437
|
-
},
|
|
438
|
-
769: {
|
|
439
|
-
slidesPerView: 6,
|
|
440
|
-
spaceBetween: 20
|
|
441
|
-
}
|
|
442
|
-
}}
|
|
443
|
-
freeMode
|
|
444
|
-
watchSlidesProgress
|
|
445
|
-
className='product-thumb'
|
|
446
|
-
watchOverflow
|
|
447
|
-
observer
|
|
448
|
-
observeParents
|
|
449
|
-
parallax
|
|
450
|
-
>
|
|
451
|
-
{gallery.map((img, i) => (
|
|
452
|
-
<SwiperSlide key={i}>
|
|
453
|
-
<img src={img} alt='' />
|
|
454
|
-
</SwiperSlide>
|
|
455
|
-
))}
|
|
456
|
-
{videoGallery && videoGallery.length > 0 && (
|
|
457
|
-
<>
|
|
458
|
-
{videoGallery.map((video, j) => (
|
|
459
|
-
<SwiperSlide key={j}>
|
|
460
|
-
<VideoGalleryWrapper>
|
|
461
|
-
<img src={getOverFlowImage(video)} alt='' />
|
|
462
|
-
<MdcPlayCircleOutline />
|
|
463
|
-
</VideoGalleryWrapper>
|
|
464
|
-
</SwiperSlide>
|
|
465
|
-
))}
|
|
466
|
-
</>
|
|
467
|
-
)}
|
|
468
|
-
</Swiper>
|
|
469
|
-
)}
|
|
470
|
-
</SwiperWrapper>
|
|
471
|
-
</WrapperImage>
|
|
473
|
+
)}
|
|
474
|
+
</SwiperWrapper>
|
|
475
|
+
</WrapperImage>
|
|
476
|
+
)}
|
|
477
|
+
{loading && !error && (
|
|
478
|
+
<SkeletonBlock width={90}>
|
|
479
|
+
<Skeleton variant='rect' height={50} />
|
|
480
|
+
<Skeleton variant='rect' height={50} />
|
|
481
|
+
<Skeleton variant='rect' height={200} />
|
|
482
|
+
</SkeletonBlock>
|
|
483
|
+
)}
|
|
484
|
+
{!loading && !error && product && (
|
|
485
|
+
<>
|
|
472
486
|
<ProductInfo>
|
|
473
487
|
<ProductFormTitle>
|
|
474
|
-
<
|
|
475
|
-
<
|
|
476
|
-
|
|
477
|
-
|
|
488
|
+
<TitleWrapper>
|
|
489
|
+
<ProductName>
|
|
490
|
+
<span>{product?.name}</span>
|
|
491
|
+
</ProductName>
|
|
492
|
+
<span className='favorite' onClick={() => handleChangeFavorite()} >
|
|
493
|
+
{product?.favorite ? <Like /> : <DisLike />}
|
|
494
|
+
</span>
|
|
495
|
+
</TitleWrapper>
|
|
478
496
|
<Properties>
|
|
479
497
|
{isHaveWeight ? (
|
|
480
498
|
<PriceContent>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</PriceContent>
|
|
481
499
|
) : (
|
|
482
500
|
<PriceContent>
|
|
483
|
-
{product?.price ? parsePrice(product?.price) : ''}
|
|
501
|
+
<p>{product?.price ? parsePrice(product?.price) : ''}</p>
|
|
484
502
|
{product?.in_offer && (<span className='offer-price'>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</span>)}
|
|
485
503
|
</PriceContent>
|
|
486
504
|
)}
|
|
487
505
|
<ProductMeta>
|
|
506
|
+
{product?.calories && (
|
|
507
|
+
<>
|
|
508
|
+
<span className='calories'>{product?.calories}{' '}cal</span>
|
|
509
|
+
<span> · </span>
|
|
510
|
+
</>
|
|
511
|
+
)}
|
|
488
512
|
{product?.sku && product?.sku !== '-1' && product?.sku !== '1' && (
|
|
489
513
|
<SkuContent>
|
|
490
514
|
<span>{t('SKU', theme?.defaultLanguages?.SKU || 'Sku')} </span>
|
|
@@ -22,6 +22,21 @@ export const ProductContainer = styled.div`
|
|
|
22
22
|
}
|
|
23
23
|
`
|
|
24
24
|
|
|
25
|
+
export const TitleWrapper = styled.div`
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 15px;
|
|
29
|
+
margin-top: 20px;
|
|
30
|
+
.favorite {
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
svg {
|
|
33
|
+
color: ${props => props.theme.colors.danger500};
|
|
34
|
+
display: flex;
|
|
35
|
+
font-size: 20px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`
|
|
39
|
+
|
|
25
40
|
export const WrapperImage = styled.div`
|
|
26
41
|
margin-left: -20px;
|
|
27
42
|
margin-top: 20px;
|
|
@@ -41,7 +56,9 @@ export const SwiperWrapper = styled.div`
|
|
|
41
56
|
.mySwiper2 {
|
|
42
57
|
height: 250px;
|
|
43
58
|
width: 100%;
|
|
44
|
-
|
|
59
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
60
|
+
height: 290px;
|
|
61
|
+
`}
|
|
45
62
|
.swiper-slide-active {
|
|
46
63
|
border-radius: 0px;
|
|
47
64
|
img {
|
|
@@ -49,11 +66,35 @@ export const SwiperWrapper = styled.div`
|
|
|
49
66
|
}
|
|
50
67
|
}
|
|
51
68
|
|
|
69
|
+
@media (min-width: 480px){
|
|
70
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
71
|
+
height: 340px;
|
|
72
|
+
`}
|
|
73
|
+
}
|
|
74
|
+
|
|
52
75
|
@media (min-width: 576px) {
|
|
53
76
|
height: 320px;
|
|
77
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
78
|
+
height: 60vw;
|
|
79
|
+
`}
|
|
54
80
|
}
|
|
81
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
82
|
+
@media (min-width: 768px) {
|
|
83
|
+
height: 40vw;
|
|
84
|
+
}
|
|
85
|
+
@media (min-width: 993px) {
|
|
86
|
+
height: 30vw;
|
|
87
|
+
}
|
|
88
|
+
@media (min-width: 1024px){
|
|
89
|
+
height: 350px !important;
|
|
90
|
+
}
|
|
91
|
+
@media (min-width: 1200px) {
|
|
92
|
+
height: 300px !important;
|
|
93
|
+
width: 300px !important;
|
|
94
|
+
}
|
|
95
|
+
`}
|
|
55
96
|
}
|
|
56
|
-
|
|
97
|
+
|
|
57
98
|
|
|
58
99
|
.swiper {
|
|
59
100
|
width: 100%;
|
|
@@ -65,6 +106,10 @@ export const SwiperWrapper = styled.div`
|
|
|
65
106
|
.swiper-slide {
|
|
66
107
|
background-size: cover;
|
|
67
108
|
background-position: center;
|
|
109
|
+
.active-img {
|
|
110
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
111
|
+
`}
|
|
112
|
+
}
|
|
68
113
|
}
|
|
69
114
|
|
|
70
115
|
.product-thumb {
|
|
@@ -83,6 +128,10 @@ export const SwiperWrapper = styled.div`
|
|
|
83
128
|
img {
|
|
84
129
|
border-radius: 7.6px;
|
|
85
130
|
max-height: 70px;
|
|
131
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
132
|
+
max-width: 80px;
|
|
133
|
+
max-height: 80px;
|
|
134
|
+
`}
|
|
86
135
|
}
|
|
87
136
|
}
|
|
88
137
|
|
|
@@ -96,6 +145,33 @@ export const SwiperWrapper = styled.div`
|
|
|
96
145
|
width: 100%;
|
|
97
146
|
height: 100%;
|
|
98
147
|
object-fit: cover;
|
|
148
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
149
|
+
border-radius: 50% !important;
|
|
150
|
+
`}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.active-img {
|
|
154
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
155
|
+
height: 60vw !important;
|
|
156
|
+
width: 60vw !important;
|
|
157
|
+
margin: 0 auto;
|
|
158
|
+
@media (min-width: 768px) {
|
|
159
|
+
height: 40vw !important;
|
|
160
|
+
width: 40vw !important;
|
|
161
|
+
}
|
|
162
|
+
@media (min-width: 993px) {
|
|
163
|
+
height: 30vw !important;
|
|
164
|
+
width: 30vw !important;
|
|
165
|
+
}
|
|
166
|
+
@media (min-width: 1024px) {
|
|
167
|
+
height: 350px !important;
|
|
168
|
+
width: 350px !important;
|
|
169
|
+
}
|
|
170
|
+
@media (min-width: 1200px) {
|
|
171
|
+
height: 300px !important;
|
|
172
|
+
width: 300px !important;
|
|
173
|
+
}
|
|
174
|
+
`}
|
|
99
175
|
}
|
|
100
176
|
|
|
101
177
|
.swiper-button-next {
|
|
@@ -406,9 +482,9 @@ export const ProductName = styled.h1`
|
|
|
406
482
|
font-size: 20px;
|
|
407
483
|
line-height: 30px;
|
|
408
484
|
color: #344050;
|
|
409
|
-
margin-bottom: 10px;
|
|
410
485
|
display: flex;
|
|
411
486
|
justify-content: space-between;
|
|
487
|
+
margin: 0;
|
|
412
488
|
.calories {
|
|
413
489
|
font-size: 16px;
|
|
414
490
|
font-weight: 100;
|
|
@@ -416,7 +492,7 @@ export const ProductName = styled.h1`
|
|
|
416
492
|
white-space: nowrap;
|
|
417
493
|
display: flex;
|
|
418
494
|
align-items: flex-end;
|
|
419
|
-
}
|
|
495
|
+
}
|
|
420
496
|
@media (min-width: 768px) {
|
|
421
497
|
font-size: 22px;
|
|
422
498
|
line-height: 34px;
|
|
@@ -424,18 +500,25 @@ export const ProductName = styled.h1`
|
|
|
424
500
|
`
|
|
425
501
|
export const Properties = styled.div`
|
|
426
502
|
display: flex;
|
|
427
|
-
|
|
503
|
+
align-items: center;
|
|
504
|
+
flex-direction: row;
|
|
505
|
+
justify-content: space-between;
|
|
506
|
+
margin-bottom: 20px;
|
|
428
507
|
`
|
|
429
508
|
export const ProductDescription = styled.p`
|
|
430
509
|
margin-top: 0px;
|
|
431
510
|
white-space: pre-wrap;
|
|
432
511
|
`
|
|
433
|
-
export const PriceContent = styled.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
512
|
+
export const PriceContent = styled.div`
|
|
513
|
+
display: flex;
|
|
514
|
+
align-items: center;
|
|
515
|
+
gap: 10px;
|
|
516
|
+
> p {
|
|
517
|
+
font-size: 18px;
|
|
518
|
+
line-height: 27px;
|
|
519
|
+
color: #344050;
|
|
520
|
+
margin: 0;
|
|
521
|
+
}
|
|
439
522
|
.offer-price {
|
|
440
523
|
text-decoration: line-through;
|
|
441
524
|
font-size: 16px;
|
|
@@ -449,7 +532,6 @@ export const ProductMeta = styled.div`
|
|
|
449
532
|
font-size: 16px;
|
|
450
533
|
line-height: 24px;
|
|
451
534
|
color: #909BA9;
|
|
452
|
-
margin-bottom: 10px;
|
|
453
535
|
}
|
|
454
536
|
`
|
|
455
537
|
export const EstimatedPersons = styled.div`
|