mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
Added support for reusable section
This commit is contained in:
parent
a740f19f8a
commit
47b0df33d4
@ -8,6 +8,7 @@ const USPSection = dynamic(() => import('components/modules/usp-section'));
|
|||||||
const Slider = dynamic(() => import('components/modules/slider'));
|
const Slider = dynamic(() => import('components/modules/slider'));
|
||||||
const BlurbSection = dynamic(() => import('components/modules/blurb-section'));
|
const BlurbSection = dynamic(() => import('components/modules/blurb-section'));
|
||||||
const FilteredProductList = dynamic(() => import('components/modules/filtered-product-list'));
|
const FilteredProductList = dynamic(() => import('components/modules/filtered-product-list'));
|
||||||
|
const ReusableSection = dynamic(() => import('components/modules/reusable-section'));
|
||||||
interface getContentComponentProps {
|
interface getContentComponentProps {
|
||||||
_type: string;
|
_type: string;
|
||||||
_key: number;
|
_key: number;
|
||||||
@ -40,6 +41,13 @@ const getContentComponent = ({ _type, _key, disabled, ...rest }: getContentCompo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'reusableSection':
|
||||||
|
if (disabled !== true) {
|
||||||
|
Component = ReusableSection;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -1,20 +1,27 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import DynamicContentManager from 'components/layout/dynamic-content-manager'
|
||||||
|
|
||||||
interface ReusableSectionProps {
|
interface ReusableSectionProps {
|
||||||
section: any
|
section: {
|
||||||
|
existingSection: {
|
||||||
|
section: {
|
||||||
|
sectionType: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReusableSection = ({ section }: ReusableSectionProps) => {
|
const ReusableSection = ({ section }:ReusableSectionProps) => {
|
||||||
console.log(section)
|
const data = section.existingSection.section.sectionType;
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="px-4 lg:px-8 2xl:px-16">
|
<DynamicContentManager content={data} />
|
||||||
<div>
|
|
||||||
Reusable section
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ReusableSection
|
export default ReusableSection;
|
@ -146,8 +146,16 @@ export const reusableSection = `
|
|||||||
_type == 'reusableSection' => {
|
_type == 'reusableSection' => {
|
||||||
disabled,
|
disabled,
|
||||||
_type,
|
_type,
|
||||||
_key,
|
title,
|
||||||
title
|
section {
|
||||||
|
existingSection-> {
|
||||||
|
section {
|
||||||
|
sectionType[] {
|
||||||
|
${modules}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user