contentoh-components-library 21.4.35 → 21.4.36
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/dist/components/atoms/Avatar/index.js +3 -2
- package/dist/components/atoms/Card/index.js +46 -5
- package/dist/components/atoms/Card/styles.js +3 -1
- package/dist/components/atoms/CheckBox/index.js +7 -2
- package/dist/components/atoms/CheckBox/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/styles.js +1 -1
- package/dist/components/atoms/SliderToolTip/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +68 -11
- package/dist/components/molecules/SignInLogin/index.js +16 -21
- package/dist/components/molecules/TagAndInput/index.js +1 -1
- package/dist/components/organisms/Chat/Chat.stories.js +27 -8
- package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +350 -197
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +49 -4
- package/dist/components/organisms/Chat/styles.js +1 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/Modal/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +6 -4
- package/dist/components/pages/ProviderProductEdition/index.js +117 -142
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +7 -3
- package/dist/components/pages/RetailerProductEdition/index.js +276 -274
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/dist/index.js +247 -52
- package/package.json +4 -1
- package/src/assets/images/defaultImages/check_circle.svg +10 -0
- package/src/components/atoms/Avatar/index.js +8 -2
- package/src/components/atoms/Card/index.js +35 -2
- package/src/components/atoms/Card/styles.js +41 -5
- package/src/components/atoms/CheckBox/index.js +4 -1
- package/src/components/atoms/CheckBox/styles.js +2 -0
- package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
- package/src/components/atoms/ImageCarousel/index.js +103 -0
- package/src/components/atoms/ImageCarousel/styles.js +79 -0
- package/src/components/atoms/InputFormatter/styles.js +2 -1
- package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
- package/src/components/atoms/PercentTag/index.js +9 -0
- package/src/components/atoms/PercentTag/styles.js +69 -0
- package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
- package/src/components/atoms/RatingStars/index.js +31 -0
- package/src/components/atoms/RatingStars/styles.js +28 -0
- package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
- package/src/components/atoms/RetailerCatalog/index.js +49 -0
- package/src/components/atoms/RetailerCatalog/styles.js +30 -0
- package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
- package/src/components/atoms/RetailerOption/index.js +53 -0
- package/src/components/atoms/RetailerOption/styles.js +41 -0
- package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
- package/src/components/atoms/RetailersList/index.js +20 -0
- package/src/components/atoms/RetailersList/styles.js +19 -0
- package/src/components/atoms/SliderToolTip/styles.js +1 -1
- package/src/components/atoms/UserCatalog/UserCatalog.stories.js +67 -0
- package/src/components/atoms/UserCatalog/index.js +100 -0
- package/src/components/atoms/UserCatalog/styles.js +24 -0
- package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
- package/src/components/atoms/UserOption/index.js +95 -0
- package/src/components/atoms/UserOption/styles.js +61 -0
- package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
- package/src/components/atoms/UserSelector/index.js +86 -0
- package/src/components/atoms/UserSelector/styles.js +55 -0
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
- package/src/components/molecules/GridItem/index.js +105 -0
- package/src/components/molecules/GridItem/styles.js +104 -0
- package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
- package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
- package/src/components/molecules/HeaderItem/index.js +26 -0
- package/src/components/molecules/HeaderItem/styles.js +27 -0
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/molecules/RowItem/ColumnItem.js +9 -0
- package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
- package/src/components/molecules/RowItem/index.js +45 -0
- package/src/components/molecules/RowItem/styles.js +40 -0
- package/src/components/molecules/SignInLogin/index.js +1 -3
- package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +14 -0
- package/src/components/molecules/StripeCardForm/index.js +45 -0
- package/src/components/molecules/StripeCardForm/paymentForm.js +126 -0
- package/src/components/molecules/StripeCardForm/styles.js +84 -0
- package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +12 -0
- package/src/components/molecules/StripeCardSelector/index.js +59 -0
- package/src/components/molecules/StripeCardSelector/styles.js +15 -0
- package/src/components/molecules/StripeCardSelector/utils.js +17 -0
- package/src/components/molecules/TagAndInput/index.js +10 -8
- package/src/components/organisms/Chat/Chat.stories.js +27 -7
- package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
- package/src/components/organisms/Chat/ContainerItems/styles.js +14 -2
- package/src/components/organisms/Chat/ContentChat/index.js +88 -12
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +46 -4
- package/src/components/organisms/Chat/styles.js +4 -0
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/GridProducts/GridProducts.stories.js +5485 -0
- package/src/components/organisms/GridProducts/index.js +50 -0
- package/src/components/organisms/GridProducts/styles.js +14 -0
- package/src/components/organisms/GridProducts/utils.js +111 -0
- package/src/components/organisms/Modal/styles.js +4 -1
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +6 -16
- package/src/components/organisms/PanelLayout/PanelLayout.stories.js +63 -0
- package/src/components/organisms/PanelLayout/index.js +11 -0
- package/src/components/organisms/PanelLayout/styles.js +39 -0
- package/src/components/organisms/SideModal/SideModal.stories.js +23 -0
- package/src/components/organisms/SideModal/index.js +50 -0
- package/src/components/organisms/SideModal/styles.js +30 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +6 -4
- package/src/components/pages/ProviderProductEdition/index.js +97 -129
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -2
- package/src/components/pages/RetailerProductEdition/index.js +111 -142
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
- package/src/index.js +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentoh-components-library",
|
|
3
|
-
"version": "21.4.
|
|
3
|
+
"version": "21.4.36",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@aws-amplify/auth": "^4.5.3",
|
|
6
6
|
"@aws-amplify/datastore": "^3.11.0",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"@mui/material": "^5.12.0",
|
|
17
17
|
"@mui/styled-engine-sc": "^5.12.0",
|
|
18
18
|
"@storybook/addon-postcss": "^2.0.0",
|
|
19
|
+
"@stripe/react-stripe-js": "^2.2.0",
|
|
20
|
+
"@stripe/stripe-js": "^2.1.4",
|
|
19
21
|
"@testing-library/jest-dom": "^5.11.4",
|
|
20
22
|
"@testing-library/react": "^11.1.0",
|
|
21
23
|
"@testing-library/user-event": "^12.1.10",
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
"contentoh-components-library": "^21.0.18",
|
|
29
31
|
"draft-js": "^0.11.7",
|
|
30
32
|
"file-saver": "^2.0.5",
|
|
33
|
+
"infinite-react-carousel": "^1.2.11",
|
|
31
34
|
"js-base64": "^3.7.2",
|
|
32
35
|
"moment": "^2.29.4",
|
|
33
36
|
"prop-types": "^15.7.2",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g id="check_circle">
|
|
3
|
+
<mask id="mask0_204_774" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="14" height="14">
|
|
4
|
+
<rect id="Bounding box" width="14" height="14" fill="#D9D9D9"/>
|
|
5
|
+
</mask>
|
|
6
|
+
<g mask="url(#mask0_204_774)">
|
|
7
|
+
<path id="check_circle_2" d="M5.9675 10.185L10.92 5.2325L10.115 4.445L5.9675 8.5925L3.8675 6.4925L3.08 7.28L5.9675 10.185ZM7 14C6.04333 14 5.13917 13.8162 4.2875 13.4487C3.43583 13.0812 2.69208 12.5796 2.05625 11.9437C1.42042 11.3079 0.91875 10.5642 0.55125 9.7125C0.18375 8.86083 0 7.95667 0 7C0 6.03167 0.18375 5.12167 0.55125 4.27C0.91875 3.41833 1.42042 2.6775 2.05625 2.0475C2.69208 1.4175 3.43583 0.91875 4.2875 0.55125C5.13917 0.18375 6.04333 0 7 0C7.96833 0 8.87833 0.18375 9.73 0.55125C10.5817 0.91875 11.3225 1.4175 11.9525 2.0475C12.5825 2.6775 13.0812 3.41833 13.4487 4.27C13.8162 5.12167 14 6.03167 14 7C14 7.95667 13.8162 8.86083 13.4487 9.7125C13.0812 10.5642 12.5825 11.3079 11.9525 11.9437C11.3225 12.5796 10.5817 13.0812 9.73 13.4487C8.87833 13.8162 7.96833 14 7 14Z" fill="#8A6CAA"/>
|
|
8
|
+
</g>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
@@ -2,12 +2,18 @@ import { Container } from "./styles";
|
|
|
2
2
|
import ReactImageFallback from "react-image-fallback";
|
|
3
3
|
import defaultProfile from "../../../assets/images/defaultImages/defaultProfileImage.svg";
|
|
4
4
|
|
|
5
|
-
export const Avatar = ({
|
|
5
|
+
export const Avatar = ({
|
|
6
|
+
image,
|
|
7
|
+
altText,
|
|
8
|
+
imageType,
|
|
9
|
+
onClick,
|
|
10
|
+
fallbackImage,
|
|
11
|
+
}) => {
|
|
6
12
|
return (
|
|
7
13
|
<Container className={imageType}>
|
|
8
14
|
<ReactImageFallback
|
|
9
15
|
src={image}
|
|
10
|
-
fallbackImage={defaultProfile}
|
|
16
|
+
fallbackImage={fallbackImage || defaultProfile}
|
|
11
17
|
alt={altText}
|
|
12
18
|
onClick={onClick}
|
|
13
19
|
/>
|
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
|
+
import { CheckBox } from "../CheckBox";
|
|
3
|
+
import { useStripe } from "@stripe/react-stripe-js";
|
|
4
|
+
|
|
5
|
+
export const Card = ({
|
|
6
|
+
card = {},
|
|
7
|
+
selectedCard,
|
|
8
|
+
setSelectedCard,
|
|
9
|
+
setCard,
|
|
10
|
+
setStripe,
|
|
11
|
+
}) => {
|
|
12
|
+
const stripe = useStripe();
|
|
13
|
+
|
|
14
|
+
const handleOnChange = (e, cardId) => {
|
|
15
|
+
if (e.target.checked) {
|
|
16
|
+
setCard && setCard({ ...card, isNew: 0 });
|
|
17
|
+
setStripe && setStripe(stripe);
|
|
18
|
+
setSelectedCard && setSelectedCard(cardId);
|
|
19
|
+
} else {
|
|
20
|
+
setSelectedCard && setSelectedCard("");
|
|
21
|
+
setCard && setCard(null);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
2
24
|
|
|
3
|
-
export const Card = ({ cardIcon, altText }) => {
|
|
4
25
|
return (
|
|
5
26
|
<Container>
|
|
6
|
-
<
|
|
27
|
+
<div className="card-details">
|
|
28
|
+
<CheckBox
|
|
29
|
+
id={card.id}
|
|
30
|
+
label={
|
|
31
|
+
<>
|
|
32
|
+
<span className="brand-card">{card.brand}</span>
|
|
33
|
+
<span>{`**** **** **** ${card.last4}`}</span>
|
|
34
|
+
</>
|
|
35
|
+
}
|
|
36
|
+
checked={selectedCard === card.id}
|
|
37
|
+
onChange={(e) => handleOnChange(e, card.id)}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
7
40
|
</Container>
|
|
8
41
|
);
|
|
9
42
|
};
|
|
@@ -1,8 +1,44 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
2
3
|
|
|
3
4
|
export const Container = styled.div`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
display: flex;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
|
|
8
|
+
.card-details {
|
|
9
|
+
label {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
height: 25px;
|
|
12
|
+
p {
|
|
13
|
+
margin-left: 40px;
|
|
14
|
+
span {
|
|
15
|
+
& + * {
|
|
16
|
+
margin-left: 20px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
& + * {
|
|
22
|
+
margin-left: 20px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cvc-input {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
color: ${GlobalColors.s4};
|
|
30
|
+
font-family: ${FontFamily.AvenirNext};
|
|
31
|
+
font-size: 13px;
|
|
32
|
+
|
|
33
|
+
.card-input {
|
|
34
|
+
border: 1px solid #f0f0f0 !important;
|
|
35
|
+
border-radius: 5px;
|
|
36
|
+
padding: 3px;
|
|
37
|
+
width: 50px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
& + * {
|
|
42
|
+
margin-top: 15px;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -7,9 +7,11 @@ export const CheckBox = ({
|
|
|
7
7
|
isFilter,
|
|
8
8
|
defaultChecked,
|
|
9
9
|
disabled = false,
|
|
10
|
+
checked,
|
|
11
|
+
className = "",
|
|
10
12
|
}) => {
|
|
11
13
|
return (
|
|
12
|
-
<Container key={`check-${id}`}>
|
|
14
|
+
<Container key={`check-${id}`} className={className}>
|
|
13
15
|
<input
|
|
14
16
|
type="checkbox"
|
|
15
17
|
name={id}
|
|
@@ -17,6 +19,7 @@ export const CheckBox = ({
|
|
|
17
19
|
onChange={onChange}
|
|
18
20
|
defaultChecked={defaultChecked}
|
|
19
21
|
disabled={disabled}
|
|
22
|
+
checked={checked}
|
|
20
23
|
/>
|
|
21
24
|
<label htmlFor={id}>
|
|
22
25
|
{label && <p className={isFilter && "filter-text"}>{label}</p>}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ImageCarousel } from ".";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/ImageCarousel",
|
|
5
|
+
component: ImageCarousel,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <ImageCarousel {...args} />;
|
|
9
|
+
export const ImageCarouselDefault = Template.bind({});
|
|
10
|
+
ImageCarouselDefault.args = {
|
|
11
|
+
imageArray: [
|
|
12
|
+
{
|
|
13
|
+
id: 35596,
|
|
14
|
+
status: null,
|
|
15
|
+
image_id: 1,
|
|
16
|
+
packing_type: "3",
|
|
17
|
+
image_type: "1",
|
|
18
|
+
article_id: "38443",
|
|
19
|
+
src: "https://d24s337exbt5zr.cloudfront.net/eyJidWNrZXQiOiJjb250ZW50LW1hbmFnZW1lbnQtaW1hZ2VzIiwia2V5IjoiaWQtMzg0NDMvMTUvMS1kNDQ2ZjIwNy0wYTkzLTQyNzgtYWZjNi01MTY2ZjIyY2EzNDMucG5nIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjoxMDAwLCJoZWlnaHQiOjEwMDAsImZpdCI6ImNvbnRhaW4iLCJiYWNrZ3JvdW5kIjp7InIiOjI1NSwiZyI6MjU1LCJiIjoyNTUsImFscGhhIjoxfX19fQ==",
|
|
20
|
+
timestamp: "2023-05-30T03:01:12.000Z",
|
|
21
|
+
id_version: 15,
|
|
22
|
+
width: null,
|
|
23
|
+
height: null,
|
|
24
|
+
scene_type: null,
|
|
25
|
+
image_shot_type: null,
|
|
26
|
+
last_modified: "2023-06-05T23:49:49.000Z",
|
|
27
|
+
name: "Central (Frente Comercial)",
|
|
28
|
+
version: 15,
|
|
29
|
+
ext: "png",
|
|
30
|
+
uuid: "d446f207-0a93-4278-afc6-5166f22ca343",
|
|
31
|
+
srcDB: "id-38443/15/1-d446f207-0a93-4278-afc6-5166f22ca343.png",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 35597,
|
|
35
|
+
status: null,
|
|
36
|
+
image_id: 3,
|
|
37
|
+
packing_type: "3",
|
|
38
|
+
image_type: "1",
|
|
39
|
+
article_id: "38443",
|
|
40
|
+
src: "https://d24s337exbt5zr.cloudfront.net/eyJidWNrZXQiOiJjb250ZW50LW1hbmFnZW1lbnQtaW1hZ2VzIiwia2V5IjoiaWQtMzg0NDMvMTUvMy0yOTZkMzU3ZC00OTUzLTRiMzktYjFjMy04YWZmZDI2NDgwMWIucG5nIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjoxMDAwLCJoZWlnaHQiOjEwMDAsImZpdCI6ImNvbnRhaW4iLCJiYWNrZ3JvdW5kIjp7InIiOjI1NSwiZyI6MjU1LCJiIjoyNTUsImFscGhhIjoxfX19fQ==",
|
|
41
|
+
timestamp: "2023-05-30T03:01:12.000Z",
|
|
42
|
+
id_version: 15,
|
|
43
|
+
width: null,
|
|
44
|
+
height: null,
|
|
45
|
+
scene_type: null,
|
|
46
|
+
image_shot_type: null,
|
|
47
|
+
last_modified: "2023-06-05T23:49:49.000Z",
|
|
48
|
+
name: "Trasera (Back)",
|
|
49
|
+
version: 15,
|
|
50
|
+
ext: "png",
|
|
51
|
+
uuid: "296d357d-4953-4b39-b1c3-8affd264801b",
|
|
52
|
+
srcDB: "id-38443/15/3-296d357d-4953-4b39-b1c3-8affd264801b.png",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 35598,
|
|
56
|
+
status: null,
|
|
57
|
+
image_id: 16,
|
|
58
|
+
packing_type: "3",
|
|
59
|
+
image_type: "1",
|
|
60
|
+
article_id: "38443",
|
|
61
|
+
src: "https://d24s337exbt5zr.cloudfront.net/eyJidWNrZXQiOiJjb250ZW50LW1hbmFnZW1lbnQtaW1hZ2VzIiwia2V5IjoiaWQtMzg0NDMvMTUvMTYtOGMzNDIzM2YtZTRiMC00MjU0LWFlYzUtZjEyN2ZiYjhkYmVkLnBuZyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MTAwMCwiaGVpZ2h0IjoxMDAwLCJmaXQiOiJjb250YWluIiwiYmFja2dyb3VuZCI6eyJyIjoyNTUsImciOjI1NSwiYiI6MjU1LCJhbHBoYSI6MX19fX0=",
|
|
62
|
+
timestamp: "2023-05-30T03:01:12.000Z",
|
|
63
|
+
id_version: 15,
|
|
64
|
+
width: null,
|
|
65
|
+
height: null,
|
|
66
|
+
scene_type: null,
|
|
67
|
+
image_shot_type: null,
|
|
68
|
+
last_modified: "2023-06-05T23:49:49.000Z",
|
|
69
|
+
name: "Detalle / Características 1",
|
|
70
|
+
version: 15,
|
|
71
|
+
ext: "png",
|
|
72
|
+
uuid: "8c34233f-e4b0-4254-aec5-f127fbb8dbed",
|
|
73
|
+
srcDB: "id-38443/15/16-8c34233f-e4b0-4254-aec5-f127fbb8dbed.png",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import ReactImageFallback from "react-image-fallback";
|
|
4
|
+
import spinner from "../../../assets/images/Icons/Spinner.gif";
|
|
5
|
+
import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos";
|
|
6
|
+
import productImage from "../../../assets/images/defaultImages/defaultProductImage.png";
|
|
7
|
+
|
|
8
|
+
export const ImageCarousel = ({ imageArray = [] }) => {
|
|
9
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
10
|
+
const [transitioning, setTransitioning] = useState(false);
|
|
11
|
+
const [isHover, setIsHover] = useState(false);
|
|
12
|
+
|
|
13
|
+
const goToNextSlide = () => {
|
|
14
|
+
if (!transitioning) {
|
|
15
|
+
setTransitioning(true);
|
|
16
|
+
setCurrentIndex((prevIndex) => (prevIndex + 1) % imageArray.length);
|
|
17
|
+
|
|
18
|
+
setTimeout(() => {
|
|
19
|
+
setTransitioning(false);
|
|
20
|
+
}, 500); // Adjust the transition duration to match your CSS
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const goToPrevSlide = () => {
|
|
25
|
+
if (!transitioning) {
|
|
26
|
+
setTransitioning(true);
|
|
27
|
+
setCurrentIndex(
|
|
28
|
+
(prevIndex) => (prevIndex - 1 + imageArray.length) % imageArray.length
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
setTransitioning(false);
|
|
33
|
+
}, 500); // Adjust the transition duration to match your CSS
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// useEffect(() => {
|
|
38
|
+
// const delay = 0;
|
|
39
|
+
// let repeat;
|
|
40
|
+
// setTimeout(() => {
|
|
41
|
+
// repeat = setInterval(() => {
|
|
42
|
+
// if (!isHover && imageArray.length > 1) goToNextSlide();
|
|
43
|
+
// }, 10000);
|
|
44
|
+
// }, delay);
|
|
45
|
+
// return () => {
|
|
46
|
+
// clearInterval(repeat);
|
|
47
|
+
// };
|
|
48
|
+
// }, [isHover]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Container
|
|
52
|
+
// onMouseEnter={() => setIsHover(true)}
|
|
53
|
+
// onMouseLeave={() => setIsHover(false)}
|
|
54
|
+
>
|
|
55
|
+
{imageArray.length > 1 && (
|
|
56
|
+
<button
|
|
57
|
+
className="prev"
|
|
58
|
+
onClick={(e) => {
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
goToPrevSlide();
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<ArrowBackIosIcon />
|
|
64
|
+
</button>
|
|
65
|
+
)}
|
|
66
|
+
<div className="slide-container">
|
|
67
|
+
{imageArray.length ? (
|
|
68
|
+
imageArray.map((img, index) => (
|
|
69
|
+
<div
|
|
70
|
+
key={index}
|
|
71
|
+
className={`image-container slide ${
|
|
72
|
+
index === currentIndex ? "active" : ""
|
|
73
|
+
}`}
|
|
74
|
+
>
|
|
75
|
+
<ReactImageFallback
|
|
76
|
+
key={index}
|
|
77
|
+
src={`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${img.src}`}
|
|
78
|
+
fallbackImage={spinner}
|
|
79
|
+
alt={img?.name}
|
|
80
|
+
style={{
|
|
81
|
+
transform: `translateX(-${currentIndex * 100}%)`,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
))
|
|
86
|
+
) : (
|
|
87
|
+
<img src={productImage} alt="not image" />
|
|
88
|
+
)}
|
|
89
|
+
</div>
|
|
90
|
+
{imageArray.length > 1 && (
|
|
91
|
+
<button
|
|
92
|
+
className="next"
|
|
93
|
+
onClick={(e) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
goToNextSlide();
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<ArrowBackIosIcon />
|
|
99
|
+
</button>
|
|
100
|
+
)}
|
|
101
|
+
</Container>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
width: 174px;
|
|
5
|
+
height: 175px;
|
|
6
|
+
border-radius: 5px 5px 0px 0px;
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
display: flex;
|
|
10
|
+
background-color: #f0f0f0;
|
|
11
|
+
|
|
12
|
+
.slide-container {
|
|
13
|
+
display: flex;
|
|
14
|
+
width: 100%;
|
|
15
|
+
|
|
16
|
+
.image-container {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
|
|
20
|
+
img {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
object-fit: fill;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.slide {
|
|
27
|
+
flex: 0 0 100%;
|
|
28
|
+
opacity: 0;
|
|
29
|
+
transition: opacity 0.5s ease-in-out;
|
|
30
|
+
|
|
31
|
+
&.active {
|
|
32
|
+
opacity: 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
& > img {
|
|
38
|
+
width: 100%;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
button {
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 0;
|
|
45
|
+
border: none;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
color: white;
|
|
49
|
+
z-index: 1;
|
|
50
|
+
height: 100%;
|
|
51
|
+
width: 30px;
|
|
52
|
+
|
|
53
|
+
svg {
|
|
54
|
+
font-size: 24px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.prev {
|
|
58
|
+
left: 0;
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
background: linear-gradient(90deg, darkgray, transparent);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
&.next {
|
|
65
|
+
right: 0;
|
|
66
|
+
|
|
67
|
+
svg {
|
|
68
|
+
transform: rotate(180deg);
|
|
69
|
+
}
|
|
70
|
+
&:hover {
|
|
71
|
+
background: linear-gradient(-90deg, darkgray, transparent);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
button:focus {
|
|
77
|
+
outline: none;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PercentTag } from ".";
|
|
2
|
+
|
|
3
|
+
export default { title: "Components/atoms/PercentTag", component: PercentTag };
|
|
4
|
+
|
|
5
|
+
const Template = (args) => <PercentTag {...args} />;
|
|
6
|
+
export const PercentTagDefault = Template.bind({});
|
|
7
|
+
PercentTagDefault.args = { percent: 88, progressBarType: "AA" };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
background-color: ${GlobalColors.s3};
|
|
6
|
+
display: inline-block;
|
|
7
|
+
padding: 0 10px;
|
|
8
|
+
border-radius: 5px;
|
|
9
|
+
font-family: ${FontFamily.Lato};
|
|
10
|
+
font-weight: 600;
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
line-height: 20px;
|
|
13
|
+
color: ${(backgroundColor) =>
|
|
14
|
+
backgroundColor === "s2" || backgroundColor === "s1"
|
|
15
|
+
? GlobalColors.s4
|
|
16
|
+
: GlobalColors.white};
|
|
17
|
+
|
|
18
|
+
&.status-CA,
|
|
19
|
+
&.status-IE {
|
|
20
|
+
background-color: ${GlobalColors.in_progress};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.status-R,
|
|
24
|
+
&.status-AS,
|
|
25
|
+
&.status-PA {
|
|
26
|
+
background-color: ${GlobalColors.reception};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.status-AA,
|
|
30
|
+
&.status-AP,
|
|
31
|
+
&.status-ACA,
|
|
32
|
+
&.status-AC {
|
|
33
|
+
background-color: ${GlobalColors.finished};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.status-RA,
|
|
37
|
+
&.status-RC,
|
|
38
|
+
&.status-RP,
|
|
39
|
+
&.status-RCA {
|
|
40
|
+
background-color: ${GlobalColors.rejected_status};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.status-Dat,
|
|
44
|
+
&.status-Dsc,
|
|
45
|
+
&.status-Imgs {
|
|
46
|
+
background-color: ${GlobalColors.s4};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.status-Ex {
|
|
50
|
+
background-color: ${GlobalColors.exported};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.status-DDI {
|
|
54
|
+
background-color: ${GlobalColors.original_purpura};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.status-GLD {
|
|
58
|
+
background-color: ${GlobalColors.in_progress};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.status-TAB {
|
|
62
|
+
background-color: ${GlobalColors.deep_gray};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.status-Pt {
|
|
66
|
+
background-color: ${GlobalColors.s2};
|
|
67
|
+
color: ${GlobalColors.s4};
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RatingStars } from ".";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/RatingStars",
|
|
5
|
+
component: RatingStars,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <RatingStars {...args} />;
|
|
9
|
+
export const RatingStarsDefault = Template.bind({});
|
|
10
|
+
RatingStarsDefault.args = { percent: 80 };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { faStar as starIcon } from "@fortawesome/free-regular-svg-icons";
|
|
3
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
|
|
7
|
+
export const RatingStars = ({ ratingValue = 0 }) => {
|
|
8
|
+
const [rating, setRating] = useState(0);
|
|
9
|
+
|
|
10
|
+
const handleRating = (value) => {
|
|
11
|
+
setRating(value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setRating(ratingValue);
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Container>
|
|
20
|
+
{[...Array(5)].map((_, index) => (
|
|
21
|
+
<span
|
|
22
|
+
key={index}
|
|
23
|
+
className={`star ${index < rating ? "active" : ""}`}
|
|
24
|
+
onClick={() => handleRating(index + 1)}
|
|
25
|
+
>
|
|
26
|
+
★
|
|
27
|
+
</span>
|
|
28
|
+
))}
|
|
29
|
+
</Container>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div`
|
|
4
|
+
font-size: 10px;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
|
|
8
|
+
.star {
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
color: #d9d9d9;
|
|
12
|
+
transition: color 0.3s;
|
|
13
|
+
line-height: 10px;
|
|
14
|
+
|
|
15
|
+
&:hover {
|
|
16
|
+
color: gold;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.active {
|
|
20
|
+
transform: scale(1.2);
|
|
21
|
+
color: #8a6caa;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:not(:first-child) {
|
|
25
|
+
margin-left: 5px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RetailerCatalog } from ".";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/RetailerCatalog",
|
|
5
|
+
component: RetailerCatalog,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <RetailerCatalog {...args} />;
|
|
9
|
+
export const RetailerCatalogDefault = Template.bind({});
|
|
10
|
+
RetailerCatalogDefault.args = {
|
|
11
|
+
limit: 3,
|
|
12
|
+
articleId: 39474,
|
|
13
|
+
orderId: 15270,
|
|
14
|
+
retailers: [
|
|
15
|
+
{
|
|
16
|
+
id: 58,
|
|
17
|
+
name: "The Home Depot Golden",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 59,
|
|
21
|
+
name: "The Home Depot Platinum",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 60,
|
|
25
|
+
name: "The Home Depot Resizing",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 61,
|
|
29
|
+
name: "Home Depot TAB",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 68,
|
|
33
|
+
name: "The Home Depot Dropship",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|