add support for page sections on generic pages
This commit is contained in:
@@ -3,9 +3,15 @@ import { ImageWithTextBlock } from "./ImageWithTextBlock";
|
||||
import { ImageSliderBlock } from "./ImageSliderBlock";
|
||||
import { HorizontalRuleBlock } from "./HorizontalRuleBlock";
|
||||
import { FeaturedBlock } from "./FeaturedBlock";
|
||||
import { PageSectionBlock, PageSectionNavigationBlock } from "./PageSection";
|
||||
|
||||
export const Blocks = ({ blocks }: any) => {
|
||||
const sections = blocks.filter(
|
||||
(block: any) => block.__typename === "PageSectionBlock"
|
||||
);
|
||||
|
||||
return blocks.map((block: any) => {
|
||||
console.log("block aaa", block);
|
||||
switch (block.blockType) {
|
||||
case "RichTextBlock":
|
||||
return <RichTextBlock block={block} />;
|
||||
@@ -22,9 +28,15 @@ export const Blocks = ({ blocks }: any) => {
|
||||
case "FeaturedBlock":
|
||||
return <FeaturedBlock block={block} />;
|
||||
break;
|
||||
case "PageSectionBlock":
|
||||
return <PageSectionBlock block={block} />;
|
||||
break;
|
||||
case "PageSectionNavigationBlock":
|
||||
return <PageSectionNavigationBlock sections={sections} />;
|
||||
break;
|
||||
default:
|
||||
return <div>Unsupported block type {block.blockType}</div>;
|
||||
console.log("unsupported block", block);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user