@ikas/code-components-mcp 1.4.0-beta.1 → 1.4.0-beta.10
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 +34 -34
- 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 +1 -1
- package/data/storefront-types.json +1 -1
- package/dist/index.js +1737 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
+
};
|