@ikas/code-components-mcp 2.1.0 → 2.2.0
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/data/framework.json +22 -5
- package/data/migration-examples/complex-header-migration/_meta.json +4 -0
- package/data/migration-examples/complex-header-migration/after-config-snippet.json +55 -0
- package/data/migration-examples/complex-header-migration/after-section.tsx +64 -0
- package/data/migration-examples/complex-header-migration/before-props-summary.json +42 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/_meta.json +4 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/after-child-styles.css +38 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/after-child.tsx +22 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/after-config-snippet.json +31 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/after-section-styles.css +25 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/after-section.tsx +17 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/before-component.tsx +32 -0
- package/data/migration-examples/custom-dynamic-list-to-component-list/before-theme-snippet.json +53 -0
- package/data/migration-examples/full-component-with-tailwind/_meta.json +4 -0
- package/data/migration-examples/full-component-with-tailwind/after-component.tsx +43 -0
- package/data/migration-examples/full-component-with-tailwind/after-config-snippet.json +25 -0
- package/data/migration-examples/full-component-with-tailwind/after-styles.css +99 -0
- package/data/migration-examples/full-component-with-tailwind/before-component.tsx +60 -0
- package/data/migration-examples/object-custom-to-inline-props/_meta.json +4 -0
- package/data/migration-examples/object-custom-to-inline-props/after-component.tsx +34 -0
- package/data/migration-examples/object-custom-to-inline-props/after-config-snippet.json +23 -0
- package/data/migration-examples/object-custom-to-inline-props/after-styles.css +38 -0
- package/data/migration-examples/object-custom-to-inline-props/before-component.tsx +30 -0
- package/data/migration-examples/object-custom-to-inline-props/before-theme-snippet.json +26 -0
- package/data/migration-examples/slider-library-replacement/_meta.json +4 -0
- package/data/migration-examples/slider-library-replacement/after-child.tsx +13 -0
- package/data/migration-examples/slider-library-replacement/after-config-snippet.json +29 -0
- package/data/migration-examples/slider-library-replacement/after-section.tsx +38 -0
- package/data/migration-examples/slider-library-replacement/after-styles.css +43 -0
- package/data/migration-examples/slider-library-replacement/before-component.tsx +39 -0
- package/data/migration-examples/slider-library-replacement/before-types-snippet.ts +14 -0
- package/data/migration.json +260 -0
- package/data/section-templates/account-info-section/children/AccountFavorites/ikas-config-snippet.json +3 -3
- package/data/section-templates/account-info-section/ikas-config-snippet.json +5 -5
- package/data/section-templates/category-images-section/ikas-config-snippet.json +1 -1
- package/data/section-templates/category-list-section/ikas-config-snippet.json +3 -3
- package/data/section-templates/component-renderer/ikas-config-snippet.json +3 -3
- package/data/section-templates/features-section/ikas-config-snippet.json +1 -1
- package/data/section-templates/footer-section/ikas-config-snippet.json +1 -1
- package/data/section-templates/header-section/children/Announcements/ikas-config-snippet.json +1 -1
- package/data/section-templates/header-section/children/Navbar/ikas-config-snippet.json +3 -3
- package/data/section-templates/header-section/ikas-config-snippet.json +3 -3
- package/data/section-templates/hero-slider-section/ikas-config-snippet.json +1 -1
- package/data/section-templates/image-handling/ikas-config-snippet.json +13 -13
- package/data/section-templates/navigation/ikas-config-snippet.json +3 -3
- package/data/section-templates/product-detail-section/children/ProductDetailDescription/ikas-config-snippet.json +1 -1
- package/data/section-templates/product-detail-section/children/ProductDetailFeatures/ikas-config-snippet.json +1 -1
- package/data/section-templates/product-detail-section/ikas-config-snippet.json +13 -13
- package/data/section-templates/product-slider-section/ikas-config-snippet.json +3 -3
- package/data/storefront-api.json +27 -1
- package/data/storefront-types.json +2 -1
- package/dist/index.js +1737 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/data/migration-examples/custom-dynamic-list-to-component-list/before-theme-snippet.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "stores-page",
|
|
5
|
+
"name": "StoresPage",
|
|
6
|
+
"displayName": "Stores Page",
|
|
7
|
+
"props": [
|
|
8
|
+
{
|
|
9
|
+
"key": "heading",
|
|
10
|
+
"type": "TEXT",
|
|
11
|
+
"displayName": "Heading"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"key": "stores",
|
|
15
|
+
"type": "CUSTOM",
|
|
16
|
+
"displayName": "Stores",
|
|
17
|
+
"customDataId": "cd_stores_list"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"key": "columns",
|
|
21
|
+
"type": "SLIDER",
|
|
22
|
+
"displayName": "Columns",
|
|
23
|
+
"sliderData": {
|
|
24
|
+
"min": 1,
|
|
25
|
+
"max": 4,
|
|
26
|
+
"defaultValue": 3
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"customData": [
|
|
33
|
+
{
|
|
34
|
+
"id": "cd_stores_list",
|
|
35
|
+
"name": "Mağazalarımız",
|
|
36
|
+
"type": "DYNAMIC_LIST",
|
|
37
|
+
"objectTypeId": "cd_store_object"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "cd_store_object",
|
|
41
|
+
"name": "Maaza",
|
|
42
|
+
"type": "OBJECT",
|
|
43
|
+
"fields": [
|
|
44
|
+
{ "key": "title", "type": "TEXT", "displayName": "Title" },
|
|
45
|
+
{ "key": "location", "type": "TEXT", "displayName": "Location" },
|
|
46
|
+
{ "key": "district", "type": "TEXT", "displayName": "District" },
|
|
47
|
+
{ "key": "phone", "type": "TEXT", "displayName": "Phone" },
|
|
48
|
+
{ "key": "image", "type": "IMAGE", "displayName": "Image" },
|
|
49
|
+
{ "key": "link", "type": "LINK", "displayName": "Link" }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getDefaultSrc } from "@ikas/bp-storefront";
|
|
2
|
+
import { Props } from "./types";
|
|
3
|
+
|
|
4
|
+
export default function CTASection({
|
|
5
|
+
image,
|
|
6
|
+
aspectRatio,
|
|
7
|
+
title,
|
|
8
|
+
content,
|
|
9
|
+
marginTop,
|
|
10
|
+
mobileMarginTop,
|
|
11
|
+
reverseLayout,
|
|
12
|
+
backgroundColor,
|
|
13
|
+
miniImage,
|
|
14
|
+
miniImageAspect,
|
|
15
|
+
imageMaxWidth,
|
|
16
|
+
textMaxWidth,
|
|
17
|
+
}: Props) {
|
|
18
|
+
return (
|
|
19
|
+
<div className="cta-wrapper" style={{ backgroundColor: backgroundColor || "transparent" }}>
|
|
20
|
+
<div
|
|
21
|
+
className={`cta-grid ${reverseLayout ? "cta-grid--reversed" : ""}`}
|
|
22
|
+
style={{
|
|
23
|
+
"--mt": `${marginTop || 0}px`,
|
|
24
|
+
"--mt-mobile": `${mobileMarginTop || 0}px`,
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<div className="cta-image-col" style={{ aspectRatio: aspectRatio || "1/1", maxWidth: imageMaxWidth || "316px" }}>
|
|
28
|
+
{image && <img src={getDefaultSrc(image)} alt="" className="cta-image" />}
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div className="cta-text-col" style={{ maxWidth: textMaxWidth || "600px" }}>
|
|
32
|
+
{miniImage && (
|
|
33
|
+
<div className="cta-mini-image" style={{ aspectRatio: miniImageAspect }}>
|
|
34
|
+
<img src={getDefaultSrc(miniImage)} alt="" className="cta-mini-img" />
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
{title && <div className="cta-title" dangerouslySetInnerHTML={{ __html: title }} />}
|
|
38
|
+
{content && <div className="cta-content" dangerouslySetInnerHTML={{ __html: content }} />}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "my-theme-cta-section",
|
|
5
|
+
"name": "CTASection",
|
|
6
|
+
"type": "section",
|
|
7
|
+
"entry": "./src/components/CTASection/index.tsx",
|
|
8
|
+
"styles": "./src/components/CTASection/styles.css",
|
|
9
|
+
"props": [
|
|
10
|
+
{ "name": "image", "displayName": "Image", "type": "IMAGE", "required": true },
|
|
11
|
+
{ "name": "aspectRatio", "displayName": "Image Aspect Ratio", "type": "TEXT", "required": false, "defaultValue": "1/1" },
|
|
12
|
+
{ "name": "title", "displayName": "Title (HTML)", "type": "RICH_TEXT", "required": false },
|
|
13
|
+
{ "name": "content", "displayName": "Content (HTML)", "type": "RICH_TEXT", "required": true },
|
|
14
|
+
{ "name": "marginTop", "displayName": "Margin Top (px)", "type": "NUMBER", "required": false, "defaultValue": 0 },
|
|
15
|
+
{ "name": "mobileMarginTop", "displayName": "Mobile Margin Top (px)", "type": "NUMBER", "required": false, "defaultValue": 0 },
|
|
16
|
+
{ "name": "reverseLayout", "displayName": "Reverse Image/Text", "type": "BOOLEAN", "required": false, "defaultValue": false },
|
|
17
|
+
{ "name": "backgroundColor", "displayName": "Background Color", "type": "COLOR", "required": false },
|
|
18
|
+
{ "name": "miniImage", "displayName": "Mini Image", "type": "IMAGE", "required": false },
|
|
19
|
+
{ "name": "miniImageAspect", "displayName": "Mini Image Aspect", "type": "TEXT", "required": false },
|
|
20
|
+
{ "name": "imageMaxWidth", "displayName": "Image Max Width", "type": "TEXT", "required": false, "defaultValue": "316px" },
|
|
21
|
+
{ "name": "textMaxWidth", "displayName": "Text Max Width", "type": "TEXT", "required": false, "defaultValue": "600px" }
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
.cta-wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.cta-grid {
|
|
6
|
+
max-width: 1700px;
|
|
7
|
+
margin: var(--mt-mobile, 0) auto 0;
|
|
8
|
+
padding: 60px 20px 0;
|
|
9
|
+
display: grid;
|
|
10
|
+
grid-template-columns: 1fr;
|
|
11
|
+
align-items: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (min-width: 1024px) {
|
|
15
|
+
.cta-grid {
|
|
16
|
+
margin-top: var(--mt, 0);
|
|
17
|
+
padding: 0 60px;
|
|
18
|
+
grid-template-columns: 1fr 1fr;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.cta-grid--reversed .cta-image-col {
|
|
23
|
+
order: 2;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cta-image-col {
|
|
27
|
+
position: relative;
|
|
28
|
+
width: 100%;
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (min-width: 1024px) {
|
|
34
|
+
.cta-image-col {
|
|
35
|
+
margin-top: 60px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.cta-image {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
object-fit: cover;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.cta-text-col {
|
|
46
|
+
margin: 0 auto;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
height: 100%;
|
|
52
|
+
padding: 0 1.5rem 1.5rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media (min-width: 1280px) {
|
|
56
|
+
.cta-text-col {
|
|
57
|
+
padding: 2.5rem;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.cta-mini-image {
|
|
62
|
+
width: 188px;
|
|
63
|
+
margin-bottom: 30px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media (min-width: 1024px) {
|
|
67
|
+
.cta-mini-image {
|
|
68
|
+
margin-bottom: 40px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.cta-mini-img {
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
object-fit: contain;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.cta-title {
|
|
79
|
+
margin-bottom: 1rem;
|
|
80
|
+
text-align: center;
|
|
81
|
+
font-size: 20px;
|
|
82
|
+
font-weight: 300;
|
|
83
|
+
line-height: 1.2;
|
|
84
|
+
color: white;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@media (min-width: 1024px) {
|
|
88
|
+
.cta-title {
|
|
89
|
+
font-size: 30px;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.cta-content {
|
|
94
|
+
text-align: center;
|
|
95
|
+
font-size: 0.875rem;
|
|
96
|
+
font-weight: 300;
|
|
97
|
+
line-height: 1.2;
|
|
98
|
+
color: white;
|
|
99
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Image } from '@ikas/storefront';
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import { CTAProps } from '../__generated__/types';
|
|
4
|
+
|
|
5
|
+
const CTA = ({
|
|
6
|
+
image,
|
|
7
|
+
aspect,
|
|
8
|
+
title,
|
|
9
|
+
content,
|
|
10
|
+
marginTop,
|
|
11
|
+
mobileMarginTop,
|
|
12
|
+
reverse,
|
|
13
|
+
bg,
|
|
14
|
+
miniImage,
|
|
15
|
+
miniImageAspect,
|
|
16
|
+
imageMaxWidth,
|
|
17
|
+
textMaxWidth,
|
|
18
|
+
}: CTAProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<div style={{ backgroundColor: bg || 'transparent' }}>
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
'--mth': `${marginTop?.value || 0}px`,
|
|
24
|
+
'--mthm': `${mobileMarginTop?.value || 0}px`,
|
|
25
|
+
} as React.CSSProperties}
|
|
26
|
+
className={`wrapper mt-[var(--mthm)] grid grid-cols-1 items-center max-lg:pt-[60px] lg:mt-[var(--mth)] lg:grid-cols-2`}
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
style={{ aspectRatio: aspect, maxWidth: imageMaxWidth || '316px' }}
|
|
30
|
+
className={`relative m-auto w-full overflow-hidden lg:mt-[60px] ${reverse ? 'order-last' : ''}`}
|
|
31
|
+
>
|
|
32
|
+
<Image image={image} layout="fill" objectFit="cover" />
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
style={{ maxWidth: textMaxWidth || '600px' }}
|
|
37
|
+
className="m-auto flex h-full flex-col items-center justify-center p-6 pt-0 xl:p-10"
|
|
38
|
+
>
|
|
39
|
+
{miniImage && (
|
|
40
|
+
<div style={{ aspectRatio: miniImageAspect }} className="relative mb-[30px] w-[188px] lg:mb-10">
|
|
41
|
+
<Image image={miniImage} layout="fill" objectFit="contain" sizes="200px" />
|
|
42
|
+
</div>
|
|
43
|
+
)}
|
|
44
|
+
{title && (
|
|
45
|
+
<div
|
|
46
|
+
className="prose mb-4 max-w-none text-center text-[20px] font-light !leading-tight text-white lg:text-[30px]"
|
|
47
|
+
dangerouslySetInnerHTML={{ __html: title }}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
<div
|
|
51
|
+
className="prose prose-sm max-w-none text-center font-light !leading-tight text-white"
|
|
52
|
+
dangerouslySetInnerHTML={{ __html: content }}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default observer(CTA);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getDefaultSrc } from "@ikas/bp-storefront";
|
|
2
|
+
import { Props } from "./types";
|
|
3
|
+
|
|
4
|
+
export default function TextBannerSection({
|
|
5
|
+
heading,
|
|
6
|
+
content,
|
|
7
|
+
image,
|
|
8
|
+
buttonLabel,
|
|
9
|
+
buttonLink,
|
|
10
|
+
buttonBgColor,
|
|
11
|
+
}: Props) {
|
|
12
|
+
return (
|
|
13
|
+
<section className="text-banner">
|
|
14
|
+
{image && (
|
|
15
|
+
<div className="text-banner-image-wrapper">
|
|
16
|
+
<img src={getDefaultSrc(image)} alt={heading || ""} className="text-banner-image" />
|
|
17
|
+
</div>
|
|
18
|
+
)}
|
|
19
|
+
<h2 className="text-banner-heading">{heading}</h2>
|
|
20
|
+
{content && (
|
|
21
|
+
<div className="text-banner-content" dangerouslySetInnerHTML={{ __html: content }} />
|
|
22
|
+
)}
|
|
23
|
+
{buttonLabel && (
|
|
24
|
+
<a
|
|
25
|
+
href={buttonLink?.href || "#"}
|
|
26
|
+
className="text-banner-button"
|
|
27
|
+
style={{ backgroundColor: buttonBgColor || "#000" }}
|
|
28
|
+
>
|
|
29
|
+
{buttonLabel}
|
|
30
|
+
</a>
|
|
31
|
+
)}
|
|
32
|
+
</section>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "my-theme-text-banner",
|
|
5
|
+
"name": "TextBannerSection",
|
|
6
|
+
"type": "section",
|
|
7
|
+
"entry": "./src/components/TextBannerSection/index.tsx",
|
|
8
|
+
"styles": "./src/components/TextBannerSection/styles.css",
|
|
9
|
+
"props": [
|
|
10
|
+
{ "name": "heading", "displayName": "Heading", "type": "TEXT", "required": true },
|
|
11
|
+
{ "name": "content", "displayName": "Content", "type": "RICH_TEXT", "required": false },
|
|
12
|
+
{ "name": "image", "displayName": "Image", "type": "IMAGE", "required": false },
|
|
13
|
+
{ "name": "buttonLabel", "displayName": "Button Label", "type": "TEXT", "required": false },
|
|
14
|
+
{ "name": "buttonLink", "displayName": "Button Link", "type": "LINK", "required": false },
|
|
15
|
+
{ "name": "buttonBgColor", "displayName": "Button Background", "type": "COLOR", "required": false, "defaultValue": "#000000" }
|
|
16
|
+
],
|
|
17
|
+
"propGroups": [
|
|
18
|
+
{ "id": "button", "name": "Button" }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"note": "The old CUSTOM OBJECT with 3 fields (label, link, bgColor) is flattened into 3 direct props. A propGroup keeps them organized in the editor."
|
|
23
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.text-banner {
|
|
2
|
+
max-width: 1700px;
|
|
3
|
+
margin: 2.5rem auto 0;
|
|
4
|
+
padding: 0 20px;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.text-banner-image-wrapper {
|
|
9
|
+
max-width: 600px;
|
|
10
|
+
margin: 0 auto 1.5rem;
|
|
11
|
+
aspect-ratio: 16/9;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.text-banner-image {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
object-fit: cover;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.text-banner-heading {
|
|
22
|
+
font-size: 1.875rem;
|
|
23
|
+
font-weight: 700;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.text-banner-content {
|
|
27
|
+
max-width: 65ch;
|
|
28
|
+
margin: 1rem auto 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.text-banner-button {
|
|
32
|
+
display: inline-block;
|
|
33
|
+
margin-top: 1.5rem;
|
|
34
|
+
padding: 0.75rem 2rem;
|
|
35
|
+
border-radius: 0.25rem;
|
|
36
|
+
color: white;
|
|
37
|
+
text-decoration: none;
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Image } from '@ikas/storefront';
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import { TextBannerProps } from '../__generated__/types';
|
|
4
|
+
|
|
5
|
+
const TextBanner = ({ heading, content, image, buttonConfig }: TextBannerProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<div className="wrapper mt-10 text-center">
|
|
8
|
+
{image && (
|
|
9
|
+
<div className="relative mx-auto mb-6 aspect-video max-w-[600px]">
|
|
10
|
+
<Image image={image} layout="fill" objectFit="cover" />
|
|
11
|
+
</div>
|
|
12
|
+
)}
|
|
13
|
+
<h2 className="text-3xl font-bold">{heading}</h2>
|
|
14
|
+
{content && (
|
|
15
|
+
<div className="prose mx-auto mt-4" dangerouslySetInnerHTML={{ __html: content }} />
|
|
16
|
+
)}
|
|
17
|
+
{buttonConfig?.label && (
|
|
18
|
+
<a
|
|
19
|
+
href={buttonConfig.link?.href || '#'}
|
|
20
|
+
style={{ backgroundColor: buttonConfig.bgColor || '#000' }}
|
|
21
|
+
className="mt-6 inline-block rounded px-8 py-3 text-white"
|
|
22
|
+
>
|
|
23
|
+
{buttonConfig.label}
|
|
24
|
+
</a>
|
|
25
|
+
)}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default observer(TextBanner);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": {
|
|
3
|
+
"dir": "TextBanner",
|
|
4
|
+
"displayName": "Text Banner",
|
|
5
|
+
"props": [
|
|
6
|
+
{ "name": "heading", "type": "TEXT", "isRequired": true },
|
|
7
|
+
{ "name": "content", "type": "RICH_TEXT", "isRequired": false },
|
|
8
|
+
{ "name": "image", "type": "IMAGE", "isRequired": false },
|
|
9
|
+
{
|
|
10
|
+
"name": "buttonConfig",
|
|
11
|
+
"type": "CUSTOM",
|
|
12
|
+
"customDataId": "button-config-id"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"customData": {
|
|
17
|
+
"id": "button-config-id",
|
|
18
|
+
"name": "Button Config",
|
|
19
|
+
"type": "OBJECT",
|
|
20
|
+
"nestedData": [
|
|
21
|
+
{ "key": "label", "type": "TEXT", "name": "Button Label" },
|
|
22
|
+
{ "key": "link", "type": "LINK", "name": "Button Link" },
|
|
23
|
+
{ "key": "bgColor", "type": "COLOR", "name": "Button Background" }
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getDefaultSrc } from "@ikas/bp-storefront";
|
|
2
|
+
import { Props } from "./types";
|
|
3
|
+
|
|
4
|
+
export default function LogoItem({ logo, width, mobileWidth, aspectRatio }: Props) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
className="logo-item"
|
|
8
|
+
style={{ "--w": width || "120px", "--mw": mobileWidth || "80px", aspectRatio: aspectRatio || "3/2" }}
|
|
9
|
+
>
|
|
10
|
+
{logo && <img src={getDefaultSrc(logo)} alt="" className="logo-image" />}
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "my-theme-logo-slider",
|
|
5
|
+
"name": "LogoSliderSection",
|
|
6
|
+
"type": "section",
|
|
7
|
+
"entry": "./src/components/LogoSliderSection/index.tsx",
|
|
8
|
+
"styles": "./src/components/LogoSliderSection/styles.css",
|
|
9
|
+
"props": [
|
|
10
|
+
{ "name": "logos", "displayName": "Logos", "type": "COMPONENT_LIST", "required": false, "filteredComponentIds": ["my-theme-logo-item"] },
|
|
11
|
+
{ "name": "marginTop", "displayName": "Margin Top", "type": "NUMBER", "required": false, "defaultValue": 0 },
|
|
12
|
+
{ "name": "mobileMarginTop", "displayName": "Mobile Margin Top", "type": "NUMBER", "required": false, "defaultValue": 0 }
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "my-theme-logo-item",
|
|
17
|
+
"name": "LogoItem",
|
|
18
|
+
"type": "component",
|
|
19
|
+
"entry": "./src/components/LogoItem/index.tsx",
|
|
20
|
+
"styles": "./src/components/LogoItem/styles.css",
|
|
21
|
+
"props": [
|
|
22
|
+
{ "name": "logo", "displayName": "Logo", "type": "IMAGE", "required": true },
|
|
23
|
+
{ "name": "width", "displayName": "Width", "type": "TEXT", "required": false, "defaultValue": "120px" },
|
|
24
|
+
{ "name": "mobileWidth", "displayName": "Mobile Width", "type": "TEXT", "required": false, "defaultValue": "80px" },
|
|
25
|
+
{ "name": "aspectRatio", "displayName": "Aspect Ratio", "type": "TEXT", "required": false, "defaultValue": "3/2" }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useRef, useEffect } from "preact/hooks";
|
|
2
|
+
import { IkasComponentRenderer } from "@ikas/bp-storefront";
|
|
3
|
+
import { Props } from "./types";
|
|
4
|
+
|
|
5
|
+
export default function LogoSliderSection({ logos, marginTop, mobileMarginTop, ...props }: Props) {
|
|
6
|
+
const trackRef = useRef<HTMLDivElement>(null);
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const track = trackRef.current;
|
|
10
|
+
if (!track) return;
|
|
11
|
+
|
|
12
|
+
let animationId: number;
|
|
13
|
+
let scrollPos = 0;
|
|
14
|
+
const speed = 0.5;
|
|
15
|
+
|
|
16
|
+
const animate = () => {
|
|
17
|
+
scrollPos += speed;
|
|
18
|
+
if (scrollPos >= track.scrollWidth / 2) scrollPos = 0;
|
|
19
|
+
track.scrollLeft = scrollPos;
|
|
20
|
+
animationId = requestAnimationFrame(animate);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
animationId = requestAnimationFrame(animate);
|
|
24
|
+
return () => cancelAnimationFrame(animationId);
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<section
|
|
29
|
+
className="logo-slider"
|
|
30
|
+
style={{ "--mt": `${marginTop || 0}px`, "--mt-mobile": `${mobileMarginTop || 0}px` }}
|
|
31
|
+
>
|
|
32
|
+
<div ref={trackRef} className="logo-track">
|
|
33
|
+
<IkasComponentRenderer id="logos" components={logos as any[]} parentProps={props} />
|
|
34
|
+
<IkasComponentRenderer id="logos-dup" components={logos as any[]} parentProps={props} />
|
|
35
|
+
</div>
|
|
36
|
+
</section>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.logo-slider {
|
|
2
|
+
margin-top: var(--mt-mobile, 0);
|
|
3
|
+
width: 100%;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
border-top: 1px solid #E3E3E3;
|
|
6
|
+
border-bottom: 1px solid #E3E3E3;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@media (min-width: 1024px) {
|
|
10
|
+
.logo-slider {
|
|
11
|
+
margin-top: var(--mt, 0);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.logo-track {
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: 30px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (min-width: 1024px) {
|
|
22
|
+
.logo-track {
|
|
23
|
+
gap: 134px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.logo-item {
|
|
28
|
+
flex: 0 0 auto;
|
|
29
|
+
width: var(--mw, 80px);
|
|
30
|
+
user-select: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (min-width: 1024px) {
|
|
34
|
+
.logo-item {
|
|
35
|
+
width: var(--w, 120px);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.logo-image {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
object-fit: contain;
|
|
43
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Image } from '@ikas/storefront';
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import { Autoplay } from 'swiper/modules';
|
|
4
|
+
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
5
|
+
import { LogoSliderProps } from '../__generated__/types';
|
|
6
|
+
|
|
7
|
+
const LogoSlider = ({ content, marginTop, mobileMarginTop }: LogoSliderProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
style={{
|
|
11
|
+
'--mth': `${marginTop?.value || 0}px`,
|
|
12
|
+
'--mthm': `${mobileMarginTop?.value || 0}px`,
|
|
13
|
+
} as React.CSSProperties}
|
|
14
|
+
className="mt-[var(--mthm)] w-full overflow-hidden border-y border-[#E3E3E3] lg:mt-[var(--mth)]"
|
|
15
|
+
>
|
|
16
|
+
<Swiper
|
|
17
|
+
modules={[Autoplay]}
|
|
18
|
+
centerInsufficientSlides
|
|
19
|
+
loop={true}
|
|
20
|
+
slidesPerView="auto"
|
|
21
|
+
spaceBetween={30}
|
|
22
|
+
autoplay={{ delay: 3000, disableOnInteraction: false }}
|
|
23
|
+
breakpoints={{ 1024: { spaceBetween: 134 } }}
|
|
24
|
+
>
|
|
25
|
+
{content.map((item) => (
|
|
26
|
+
<SwiperSlide
|
|
27
|
+
style={{ aspectRatio: item.aspect, '--w': item.width, '--mw': item.mobWidth || item.width } as React.CSSProperties}
|
|
28
|
+
className="relative my-auto !w-[--mw] select-none lg:!w-[--w]"
|
|
29
|
+
key={item.logo.id}
|
|
30
|
+
>
|
|
31
|
+
<Image image={item.logo} layout="fill" objectFit="contain" sizes={item.width} />
|
|
32
|
+
</SwiperSlide>
|
|
33
|
+
))}
|
|
34
|
+
</Swiper>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default observer(LogoSlider);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IkasSlider, IkasImage } from '@ikas/storefront';
|
|
2
|
+
|
|
3
|
+
export type LogoSlider = {
|
|
4
|
+
logo: IkasImage;
|
|
5
|
+
width: string;
|
|
6
|
+
mobWidth: string;
|
|
7
|
+
aspect: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type LogoSliderProps = {
|
|
11
|
+
content: LogoSlider[];
|
|
12
|
+
marginTop: IkasSlider;
|
|
13
|
+
mobileMarginTop: IkasSlider;
|
|
14
|
+
};
|