vviinn-widgets 2.2.1 → 2.3.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/dist/cjs/{app-globals-d0251be8.js → app-globals-6b5da080.js} +1 -1
- package/dist/cjs/cropper-handler.cjs.entry.js +1 -1
- package/dist/cjs/{customized-slots-14b77e4a.js → customized-slots-8bc78ad4.js} +1 -1
- package/dist/cjs/highlight-box_22.cjs.entry.js +4 -4
- package/dist/cjs/{imageSearch.store-d9ed1a5b.js → imageSearch.store-042e9f45.js} +1 -1
- package/dist/cjs/{index-141137b2.js → index-553c2b4f.js} +1 -1
- package/dist/cjs/{index-a5e15a0c.js → index-5b9a60ac.js} +7 -9
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{vviinn-carousel_5.cjs.entry.js → vviinn-carousel_3.cjs.entry.js} +6 -92
- package/dist/cjs/vviinn-error.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-preloader.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +63 -0
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +44 -0
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +4 -4
- package/dist/cjs/vviinn-vps-widget.cjs.entry.js +3 -3
- package/dist/cjs/vviinn-widgets.cjs.js +3 -3
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +4 -0
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +6 -3
- package/dist/collection/components/vviinn-icons/index.js +6 -8
- package/dist/collection/components/vviinn-product-card/stories/args.js +73 -0
- package/dist/collection/components/vviinn-product-card/stories/decorators.js +51 -0
- package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +105 -0
- package/dist/collection/components/vviinn-vpr-button/stories/args.js +207 -0
- package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +89 -0
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +11 -4
- package/dist/collection/components/vviinn-vpr-widget/stories/args.js +190 -0
- package/dist/collection/components/vviinn-vpr-widget/stories/decorators.js +29 -0
- package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +212 -0
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +1 -0
- package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +31 -0
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.css +3 -0
- package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +33 -0
- package/dist/esm/{app-globals-b6113170.js → app-globals-90d99f95.js} +1 -1
- package/dist/esm/cropper-handler.entry.js +1 -1
- package/dist/esm/{customized-slots-a952fb80.js → customized-slots-65b2467d.js} +1 -1
- package/dist/esm/highlight-box_22.entry.js +4 -4
- package/dist/esm/{imageSearch.store-4ca31230.js → imageSearch.store-f35e14f8.js} +1 -1
- package/dist/esm/{index-017f18de.js → index-ac2e3b9d.js} +8 -10
- package/dist/esm/{index-3e85e294.js → index-d7c7df1c.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{vviinn-carousel_5.entry.js → vviinn-carousel_3.entry.js} +7 -91
- package/dist/esm/vviinn-error.entry.js +1 -1
- package/dist/esm/vviinn-preloader.entry.js +2 -2
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +59 -0
- package/dist/esm/vviinn-vpr-button.entry.js +40 -0
- package/dist/esm/vviinn-vps-button.entry.js +4 -4
- package/dist/esm/vviinn-vps-widget.entry.js +3 -3
- package/dist/esm/vviinn-widgets.js +3 -3
- package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +3 -0
- package/dist/types/components/vviinn-product-card/stories/args.d.ts +73 -0
- package/dist/types/components/vviinn-product-card/stories/decorators.d.ts +1 -0
- package/dist/types/components/vviinn-product-card/stories/vviinn-product-card.stories.d.ts +80 -0
- package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +207 -0
- package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +214 -0
- package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +3 -0
- package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +198 -0
- package/dist/types/components/vviinn-vpr-widget/stories/decorators.d.ts +2 -0
- package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +141 -0
- package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +1 -0
- package/dist/types/components/vviinn-vps-button/stories/vviinn-vps-button.stories.d.ts +12 -0
- package/dist/types/components/{vviinn-vpr-button/stories/kek.stories.d.ts → vviinn-vps-widget/stories/vviinn-vps-widget.stories.d.ts} +5 -2
- package/{www/build/p-68900093.entry.js → dist/vviinn-widgets/p-1c141479.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-62a1b042.entry.js → p-320844ea.entry.js} +1 -1
- package/dist/vviinn-widgets/p-4530ca32.entry.js +1 -0
- package/dist/vviinn-widgets/p-55491d9b.js +1 -0
- package/dist/vviinn-widgets/p-6239a782.entry.js +1 -0
- package/dist/vviinn-widgets/{p-d7894eaf.js → p-679ea2ce.js} +1 -1
- package/dist/vviinn-widgets/{p-95e53d99.entry.js → p-757849fd.entry.js} +1 -1
- package/{www/build/p-3da18d7f.js → dist/vviinn-widgets/p-80f0d4e0.js} +1 -1
- package/dist/vviinn-widgets/{p-6c4c240d.entry.js → p-935b4f49.entry.js} +1 -1
- package/dist/vviinn-widgets/p-a5b69a48.entry.js +1 -0
- package/dist/vviinn-widgets/{p-0ed1ef7e.entry.js → p-b0243e84.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-db0be4cd.js → p-b4b46a70.js} +1 -1
- package/dist/vviinn-widgets/{p-9fee20e7.entry.js → p-e362fa80.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-16e49514.js → p-e882fbeb.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +1 -1
- package/{dist/vviinn-widgets/p-68900093.entry.js → www/build/p-1c141479.entry.js} +1 -1
- package/www/build/{p-62a1b042.entry.js → p-320844ea.entry.js} +1 -1
- package/www/build/p-4379b1c2.js +1 -0
- package/www/build/p-4530ca32.entry.js +1 -0
- package/www/build/p-55491d9b.js +1 -0
- package/www/build/p-6239a782.entry.js +1 -0
- package/www/build/{p-d7894eaf.js → p-679ea2ce.js} +1 -1
- package/www/build/{p-95e53d99.entry.js → p-757849fd.entry.js} +1 -1
- package/{dist/vviinn-widgets/p-3da18d7f.js → www/build/p-80f0d4e0.js} +1 -1
- package/www/build/{p-6c4c240d.entry.js → p-935b4f49.entry.js} +1 -1
- package/www/build/p-a5b69a48.entry.js +1 -0
- package/www/build/{p-0ed1ef7e.entry.js → p-b0243e84.entry.js} +1 -1
- package/www/build/{p-db0be4cd.js → p-b4b46a70.js} +1 -1
- package/www/build/{p-9fee20e7.entry.js → p-e362fa80.entry.js} +1 -1
- package/www/build/{p-16e49514.js → p-e882fbeb.js} +1 -1
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +4 -74
- package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +0 -18
- package/dist/vviinn-widgets/p-eb15116d.entry.js +0 -1
- package/dist/vviinn-widgets/p-f00fddbb.js +0 -1
- package/www/build/p-1cc0cdfd.js +0 -1
- package/www/build/p-eb15116d.entry.js +0 -1
- package/www/build/p-f00fddbb.js +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const argTypes = {
|
|
2
|
+
imageWidth: {
|
|
3
|
+
name: "Card width (px)",
|
|
4
|
+
},
|
|
5
|
+
imageBorder: {
|
|
6
|
+
name: "Image border",
|
|
7
|
+
},
|
|
8
|
+
imageBorderColor: {
|
|
9
|
+
name: "Image border color",
|
|
10
|
+
control: {
|
|
11
|
+
type: "color",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
imageBackground: {
|
|
15
|
+
name: "Image background",
|
|
16
|
+
description: "Adding a light-gray filter on top of the image to distinguish it from the rest of the product card content.",
|
|
17
|
+
},
|
|
18
|
+
showBrand: {
|
|
19
|
+
name: "Show brand",
|
|
20
|
+
description: "Using the [title] attribute from product feed.",
|
|
21
|
+
},
|
|
22
|
+
titleLineCount: {
|
|
23
|
+
name: "Number of text lines for Product title",
|
|
24
|
+
options: [1, 2, 3],
|
|
25
|
+
control: {
|
|
26
|
+
type: "select",
|
|
27
|
+
default: 0,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
locale: {
|
|
31
|
+
name: "Locale",
|
|
32
|
+
options: ["de-DE", "en-US"],
|
|
33
|
+
control: {
|
|
34
|
+
type: "select",
|
|
35
|
+
default: 0,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
currencyValue: {
|
|
39
|
+
name: "Currency",
|
|
40
|
+
options: ["$", "€", "£", "¥", "₽"],
|
|
41
|
+
control: {
|
|
42
|
+
type: "select",
|
|
43
|
+
default: 0,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
contentAlignment: {
|
|
47
|
+
name: "Content alignment",
|
|
48
|
+
options: ["Left", "Centered", "Right"],
|
|
49
|
+
mapping: {
|
|
50
|
+
Left: 0,
|
|
51
|
+
Centered: 1,
|
|
52
|
+
Right: 2,
|
|
53
|
+
},
|
|
54
|
+
control: {
|
|
55
|
+
type: "select",
|
|
56
|
+
default: 0,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
primaryTextColor: {
|
|
60
|
+
name: "Primary text color",
|
|
61
|
+
control: {
|
|
62
|
+
type: "color",
|
|
63
|
+
},
|
|
64
|
+
description: "Used where the most user attention is needed: product brand, product title, and price.",
|
|
65
|
+
},
|
|
66
|
+
secondaryTextColor: {
|
|
67
|
+
name: "Secondary text color",
|
|
68
|
+
description: "Used in Old Price",
|
|
69
|
+
control: {
|
|
70
|
+
type: "color",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const productDecorator = (story) => `
|
|
2
|
+
<style>
|
|
3
|
+
html, body, #root, #root-inner {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#root-inner {
|
|
9
|
+
display: grid;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-items: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.product-wrapper {
|
|
15
|
+
width: 240px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
vviinn-product-card {
|
|
19
|
+
align-items: start;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
vviinn-product-card::part(image) {
|
|
23
|
+
border: 1px solid #DDDDDD;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
vviinn-product-card::part(brand) {
|
|
27
|
+
display: flex;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
font-size: 16px;
|
|
30
|
+
line-height: 24px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
vviinn-product-card::part(brand),
|
|
34
|
+
vviinn-product-card::part(title) {
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
vviinn-product-card::part(title) {
|
|
39
|
+
order: 2;
|
|
40
|
+
max-width: unset;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
vviinn-product-card::part(price-container) {
|
|
44
|
+
order: 3;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
</style>
|
|
48
|
+
<div class="product-wrapper">
|
|
49
|
+
${story()}
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { argTypes } from "./args";
|
|
2
|
+
import { productDecorator } from "./decorators";
|
|
3
|
+
export default {
|
|
4
|
+
title: "Elements/Product Card",
|
|
5
|
+
component: "vviinn-product-card",
|
|
6
|
+
decorators: [
|
|
7
|
+
productDecorator
|
|
8
|
+
],
|
|
9
|
+
argTypes
|
|
10
|
+
};
|
|
11
|
+
const showImageBorders = (x, color) => {
|
|
12
|
+
const borderRule = x ? `1px solid ${color}` : "none";
|
|
13
|
+
return `
|
|
14
|
+
vviinn-product-card::part(image) {
|
|
15
|
+
border: ${borderRule};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
};
|
|
19
|
+
const setupBrandVisibility = (show) => `
|
|
20
|
+
vviinn-product-card::part(brand) {
|
|
21
|
+
display: ${show ? "flex" : "none"};
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const setupTitleLineCount = (count) => `
|
|
25
|
+
vviinn-product-card::part(title) {
|
|
26
|
+
-webkit-line-clamp: ${count};
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
const allignementLeft = `
|
|
30
|
+
vviinn-product-card::part(title),
|
|
31
|
+
vviinn-product-card::part(brand),
|
|
32
|
+
vviinn-product-card::part(type),
|
|
33
|
+
vviinn-product-card::part(deeplink),
|
|
34
|
+
vviinn-product-card::part(price-container) {
|
|
35
|
+
align-self: start;
|
|
36
|
+
text-align: left;
|
|
37
|
+
}`;
|
|
38
|
+
const allignementCenter = `
|
|
39
|
+
vviinn-product-card::part(title),
|
|
40
|
+
vviinn-product-card::part(brand),
|
|
41
|
+
vviinn-product-card::part(type),
|
|
42
|
+
vviinn-product-card::part(deeplink),
|
|
43
|
+
vviinn-product-card::part(price-container) {
|
|
44
|
+
align-self: center;
|
|
45
|
+
text-align: center;
|
|
46
|
+
}`;
|
|
47
|
+
const allignementRight = `
|
|
48
|
+
vviinn-product-card::part(title),
|
|
49
|
+
vviinn-product-card::part(brand),
|
|
50
|
+
vviinn-product-card::part(type),
|
|
51
|
+
vviinn-product-card::part(deeplink),
|
|
52
|
+
vviinn-product-card::part(price-container) {
|
|
53
|
+
align-self: end;
|
|
54
|
+
text-align: right;
|
|
55
|
+
}`;
|
|
56
|
+
const allignement = new Map([
|
|
57
|
+
[0, allignementLeft],
|
|
58
|
+
[1, allignementCenter],
|
|
59
|
+
[2, allignementRight],
|
|
60
|
+
]);
|
|
61
|
+
const Template = (args) => `
|
|
62
|
+
<style>
|
|
63
|
+
${allignement.get(args.contentAlignment)}
|
|
64
|
+
${showImageBorders(args.imageBorder, args.imageBorderColor)}
|
|
65
|
+
${setupBrandVisibility(args.showBrand)}
|
|
66
|
+
${setupTitleLineCount(args.titleLineCount)}
|
|
67
|
+
|
|
68
|
+
vviinn-product-card::part(title),
|
|
69
|
+
vviinn-product-card::part(brand),
|
|
70
|
+
vviinn-product-card::part(type),
|
|
71
|
+
vviinn-product-card::part(price-sale),
|
|
72
|
+
vviinn-product-card::part(price-regular) {
|
|
73
|
+
color: ${args.primaryTextColor};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
vviinn-product-card::part(price-outdated) {
|
|
77
|
+
color: ${args.secondaryTextColor};
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
80
|
+
<vviinn-product-card
|
|
81
|
+
product-title="Couchtisch Rolf Benz 8770 Ronald Schmitt"
|
|
82
|
+
brand="Ronald Schmitt"
|
|
83
|
+
product-type="Couchtische"
|
|
84
|
+
price="3629"
|
|
85
|
+
sale-price="1653"
|
|
86
|
+
image="https://www.moebel-shop.de/media/image/e3/e9/28/0749295-001_600x600.jpg"
|
|
87
|
+
image-width="${args.imageWidth}"
|
|
88
|
+
dimmed-background="${args.imageBackground}"
|
|
89
|
+
locale="${args.locale}"
|
|
90
|
+
currency="${args.currencyValue}"
|
|
91
|
+
></vviinn-product-card>`;
|
|
92
|
+
export const Default = Template.bind({});
|
|
93
|
+
Default.args = {
|
|
94
|
+
imageWidth: 240,
|
|
95
|
+
contentAlignment: "Left",
|
|
96
|
+
imageBorder: true,
|
|
97
|
+
imageBorderColor: "#dddddd",
|
|
98
|
+
imageBackground: false,
|
|
99
|
+
primaryTextColor: "#161616",
|
|
100
|
+
secondaryTextColor: "#757575",
|
|
101
|
+
showBrand: false,
|
|
102
|
+
titleLineCount: 2,
|
|
103
|
+
locale: "en-US",
|
|
104
|
+
currencyValue: "€"
|
|
105
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export const argTypes = {
|
|
2
|
+
buttonSize: {
|
|
3
|
+
name: "Button size",
|
|
4
|
+
options: ["Default", "Small", "Large"],
|
|
5
|
+
mapping: {
|
|
6
|
+
Default: 40,
|
|
7
|
+
Small: 32,
|
|
8
|
+
Large: 48,
|
|
9
|
+
},
|
|
10
|
+
control: {
|
|
11
|
+
type: "select",
|
|
12
|
+
labels: {
|
|
13
|
+
Default: "Default (40px)",
|
|
14
|
+
Small: "Small (32px)",
|
|
15
|
+
Large: "Large (48px)",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultValue: "Default",
|
|
19
|
+
},
|
|
20
|
+
iconColor: {
|
|
21
|
+
name: "Icon color",
|
|
22
|
+
control: {
|
|
23
|
+
type: "color",
|
|
24
|
+
},
|
|
25
|
+
defaultValue: "#000000",
|
|
26
|
+
},
|
|
27
|
+
backgroundColor: {
|
|
28
|
+
name: "Background color",
|
|
29
|
+
control: {
|
|
30
|
+
type: "color",
|
|
31
|
+
},
|
|
32
|
+
defaultValue: "#ffffff",
|
|
33
|
+
},
|
|
34
|
+
backgroundOpacity: {
|
|
35
|
+
name: "Background opacity (%)",
|
|
36
|
+
control: {
|
|
37
|
+
type: "number",
|
|
38
|
+
},
|
|
39
|
+
defaultValue: 100,
|
|
40
|
+
},
|
|
41
|
+
radius: {
|
|
42
|
+
name: "Radius (px)",
|
|
43
|
+
control: {
|
|
44
|
+
type: "number",
|
|
45
|
+
},
|
|
46
|
+
defaultValue: 20,
|
|
47
|
+
},
|
|
48
|
+
border: {
|
|
49
|
+
name: "Border",
|
|
50
|
+
control: {
|
|
51
|
+
type: "boolean",
|
|
52
|
+
},
|
|
53
|
+
defaultValue: false,
|
|
54
|
+
},
|
|
55
|
+
borderColor: {
|
|
56
|
+
name: "Border color",
|
|
57
|
+
control: {
|
|
58
|
+
type: "color",
|
|
59
|
+
},
|
|
60
|
+
defaultValue: "#cccccc",
|
|
61
|
+
},
|
|
62
|
+
shadow: {
|
|
63
|
+
name: "Shadow",
|
|
64
|
+
control: {
|
|
65
|
+
type: "boolean",
|
|
66
|
+
},
|
|
67
|
+
defaultValue: true,
|
|
68
|
+
},
|
|
69
|
+
position: {
|
|
70
|
+
name: "Modal container appearance",
|
|
71
|
+
options: ["bottom", "right"],
|
|
72
|
+
control: {
|
|
73
|
+
type: "select",
|
|
74
|
+
labels: {
|
|
75
|
+
bottom: "From bottom",
|
|
76
|
+
right: "From right",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
defaultValue: "bottom",
|
|
80
|
+
},
|
|
81
|
+
backdropOpacity: {
|
|
82
|
+
name: "Backdrop opacity (%)",
|
|
83
|
+
control: {
|
|
84
|
+
type: "number",
|
|
85
|
+
},
|
|
86
|
+
defaultValue: 50,
|
|
87
|
+
},
|
|
88
|
+
sidebarBorderRadius: {
|
|
89
|
+
name: "Modal container round corners (px)",
|
|
90
|
+
control: {
|
|
91
|
+
type: "number",
|
|
92
|
+
},
|
|
93
|
+
defaultValue: 16,
|
|
94
|
+
},
|
|
95
|
+
showSourceImage: {
|
|
96
|
+
name: "Modal container show source image",
|
|
97
|
+
control: {
|
|
98
|
+
type: "boolean",
|
|
99
|
+
},
|
|
100
|
+
defaultValue: true,
|
|
101
|
+
},
|
|
102
|
+
sourceImageSize: {
|
|
103
|
+
name: "Source image size",
|
|
104
|
+
options: ["Default", "Small", "Large"],
|
|
105
|
+
mapping: {
|
|
106
|
+
Default: 64,
|
|
107
|
+
Small: 48,
|
|
108
|
+
Large: 80,
|
|
109
|
+
},
|
|
110
|
+
control: {
|
|
111
|
+
type: "select",
|
|
112
|
+
labels: {
|
|
113
|
+
Default: "Default (64px)",
|
|
114
|
+
Small: "Small (48px)",
|
|
115
|
+
Large: "Large (80px)",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
defaultValue: "Default",
|
|
119
|
+
},
|
|
120
|
+
sourceImageBorder: {
|
|
121
|
+
name: "Source image border",
|
|
122
|
+
control: {
|
|
123
|
+
type: "boolean",
|
|
124
|
+
},
|
|
125
|
+
defaultValue: false,
|
|
126
|
+
},
|
|
127
|
+
sourceImageBorderColor: {
|
|
128
|
+
name: "Source image border color",
|
|
129
|
+
control: {
|
|
130
|
+
type: "color",
|
|
131
|
+
},
|
|
132
|
+
defaultValue: "#cccccc",
|
|
133
|
+
},
|
|
134
|
+
sourceImageShadow: {
|
|
135
|
+
name: "Source image shadow",
|
|
136
|
+
control: {
|
|
137
|
+
type: "boolean",
|
|
138
|
+
},
|
|
139
|
+
defaultValue: true,
|
|
140
|
+
},
|
|
141
|
+
font: {
|
|
142
|
+
name: "Font family",
|
|
143
|
+
options: ["Inter", "System", "Arial"],
|
|
144
|
+
mapping: {
|
|
145
|
+
Inter: "'Inter', sans-serif",
|
|
146
|
+
System: `-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`,
|
|
147
|
+
Arial: "Arial, sans-serif",
|
|
148
|
+
},
|
|
149
|
+
control: {
|
|
150
|
+
type: "select",
|
|
151
|
+
labels: {
|
|
152
|
+
Inter: "Inter",
|
|
153
|
+
System: "System stack",
|
|
154
|
+
Arial: "Arial (web safe)",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
defaultValue: "Inter",
|
|
158
|
+
},
|
|
159
|
+
primaryTextColor: {
|
|
160
|
+
name: "Primary text color",
|
|
161
|
+
control: {
|
|
162
|
+
type: "color",
|
|
163
|
+
},
|
|
164
|
+
defaultValue: "#161616",
|
|
165
|
+
},
|
|
166
|
+
secondaryTextColor: {
|
|
167
|
+
name: "Secondary text color",
|
|
168
|
+
control: {
|
|
169
|
+
type: "color",
|
|
170
|
+
},
|
|
171
|
+
defaultValue: "#757575",
|
|
172
|
+
},
|
|
173
|
+
modalTitle: {
|
|
174
|
+
name: "Modal container title",
|
|
175
|
+
control: {
|
|
176
|
+
type: "boolean",
|
|
177
|
+
},
|
|
178
|
+
defaultValue: true,
|
|
179
|
+
},
|
|
180
|
+
sidebarTitle: {
|
|
181
|
+
name: "Modal container title name",
|
|
182
|
+
control: {
|
|
183
|
+
type: "text",
|
|
184
|
+
},
|
|
185
|
+
defaultValue: "Visually similar products",
|
|
186
|
+
},
|
|
187
|
+
modalTitleFontSize: {
|
|
188
|
+
name: "Modal container title font size (px)",
|
|
189
|
+
control: {
|
|
190
|
+
type: "number",
|
|
191
|
+
},
|
|
192
|
+
defaultValue: 28,
|
|
193
|
+
},
|
|
194
|
+
modalScrollbar: {
|
|
195
|
+
name: "Use default horizontal scrollbar in modal container",
|
|
196
|
+
control: {
|
|
197
|
+
type: "boolean",
|
|
198
|
+
},
|
|
199
|
+
defaultValue: false,
|
|
200
|
+
},
|
|
201
|
+
productId: {
|
|
202
|
+
name: "Product id",
|
|
203
|
+
},
|
|
204
|
+
token: {
|
|
205
|
+
name: "Token",
|
|
206
|
+
},
|
|
207
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { withDesign } from "storybook-addon-designs";
|
|
2
|
+
import { argTypes } from "./args";
|
|
3
|
+
const centerDecorator = (story) => `
|
|
4
|
+
<div style="display: grid;
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
left: 0;
|
|
9
|
+
right: 0;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-items: center;">
|
|
12
|
+
${story()}
|
|
13
|
+
</div>
|
|
14
|
+
`;
|
|
15
|
+
export default {
|
|
16
|
+
title: "Widgets/Visual Recommendations/Button",
|
|
17
|
+
component: "vviinn-vpr-button",
|
|
18
|
+
decorators: [withDesign, centerDecorator],
|
|
19
|
+
argTypes,
|
|
20
|
+
};
|
|
21
|
+
const Template = (args) => `<style>
|
|
22
|
+
body {
|
|
23
|
+
font-family: ${args.font};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
vviinn-vpr-button::part(button) {
|
|
27
|
+
width: ${args.buttonSize}px;
|
|
28
|
+
height: ${args.buttonSize}px;
|
|
29
|
+
fill: ${args.iconColor};
|
|
30
|
+
background: ${args.backgroundColor};
|
|
31
|
+
opacity: ${args.backgroundOpacity}%;
|
|
32
|
+
border-radius: ${args.radius}px;
|
|
33
|
+
border: ${args.border ? "1px solid" : "none"};
|
|
34
|
+
border-color: ${args.borderColor};
|
|
35
|
+
${args.shadow ? "" : "box-shadow: none;"}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
vviinn-recommendations-sidebar::part(title) {
|
|
39
|
+
display: ${args.modalTitle ? "inline" : "none"};
|
|
40
|
+
font-size: ${args.modalTitleFontSize}px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
vviinn-recommendations-sidebar::part(product-title),
|
|
44
|
+
vviinn-recommendations-sidebar::part(brand),
|
|
45
|
+
vviinn-recommendations-sidebar::part(type),
|
|
46
|
+
vviinn-recommendations-sidebar::part(price-regular),
|
|
47
|
+
vviinn-recommendations-sidebar::part(price-sale) {
|
|
48
|
+
color: ${args.primaryTextColor};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
vviinn-recommendations-sidebar::part(price-outdated) {
|
|
52
|
+
color: ${args.secondaryTextColor};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
vviinn-recommendations-sidebar.open {
|
|
56
|
+
background: rgba(0, 0, 0, 0.1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
vviinn-recommendations-sidebar::part(body) {
|
|
60
|
+
border-radius: ${args.sidebarBorderRadius}px ${args.sidebarBorderRadius}px 0 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
vviinn-recommendations-sidebar::part(source-image) {
|
|
64
|
+
width: ${args.sourceImageSize}px;
|
|
65
|
+
height: ${args.sourceImageSize}px;
|
|
66
|
+
border: ${args.sourceImageBorder ? "1px solid" : "none"};
|
|
67
|
+
border-color: ${args.sourceImageBorderColor};
|
|
68
|
+
${args.sourceImageShadow ? "" : "box-shadow: none;"}
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
71
|
+
<vviinn-vpr-button token="${args.token}"
|
|
72
|
+
product-id="${args.productId}"
|
|
73
|
+
position="${args.position}"
|
|
74
|
+
sidebar-title="${args.sidebarTitle}"
|
|
75
|
+
modal-scrollbar="${args.modalScrollbar}"
|
|
76
|
+
source-image="${args.showSourceImage
|
|
77
|
+
? "https://www.moebel-shop.de/media/image/e3/e9/28/0749295-001_600x600.jpg"
|
|
78
|
+
: ""}"></vviinn-vpr-button>`;
|
|
79
|
+
export const Default = Template.bind({});
|
|
80
|
+
Default.args = {
|
|
81
|
+
token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4",
|
|
82
|
+
productId: "4114460310",
|
|
83
|
+
};
|
|
84
|
+
Default.parameters = {
|
|
85
|
+
design: {
|
|
86
|
+
type: "figma",
|
|
87
|
+
url: "https://www.figma.com/file/YR5ZK1s4z9ZRUXytB8uVuj/Widgets?node-id=591%3A3859",
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -10,6 +10,10 @@ export class VviinnVprButton {
|
|
|
10
10
|
this.sourceImage = null;
|
|
11
11
|
this.sidebarTitle = "Visually similar products";
|
|
12
12
|
this.modalScrollbar = false;
|
|
13
|
+
this.sidebar = null;
|
|
14
|
+
this.sidebarCloseListener = () => {
|
|
15
|
+
document.body.removeChild(this.sidebar);
|
|
16
|
+
};
|
|
13
17
|
}
|
|
14
18
|
render() {
|
|
15
19
|
return (h(Host, null,
|
|
@@ -25,10 +29,13 @@ export class VviinnVprButton {
|
|
|
25
29
|
sidebar.position = this.position;
|
|
26
30
|
sidebar.sourceImage = this.sourceImage;
|
|
27
31
|
sidebar.widgetScrollbar = this.modalScrollbar;
|
|
28
|
-
sidebar
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
this.sidebar = sidebar;
|
|
33
|
+
sidebar.addEventListener("modalClosed", this.sidebarCloseListener);
|
|
34
|
+
document.body.append(this.sidebar);
|
|
35
|
+
}
|
|
36
|
+
disconnectedCallback() {
|
|
37
|
+
this.sidebar.removeEventListener("modalCLosed", this.sidebarCloseListener);
|
|
38
|
+
document.body.removeChild(this.sidebar);
|
|
32
39
|
}
|
|
33
40
|
static get is() { return "vviinn-vpr-button"; }
|
|
34
41
|
static get encapsulation() { return "shadow"; }
|