Skip to content

Commit

Permalink
fix: changed pageBlock prop to defaultValue
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfokrah committed Sep 27, 2024
1 parent e8ff594 commit eadb651
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/blocks/blog-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const BlogContent: Block<BlogContentProps> = ({ content, pageBlockId = '', image
/>
)}
/>
<Slot pageBlocks={content} propName="content" pageBlockId={pageBlockId} />
<Slot defaultValue={content} propName="content" pageBlockId={pageBlockId} />
</div>
</div>
);
Expand Down
12 changes: 6 additions & 6 deletions src/components/exposed-components/slot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import { useProjectConfigurationState } from '@/lib/states/useProjectConfigState
import { cn, getProjectMode } from '@/lib/utils';

type SlotProps = {
pageBlocks: PageBlock[];
defaultValue: PageBlock[];
direction?: 'horizontal' | 'vertical';
className?: string;
propName: string;
pageBlockId: string;
};
export default function Slot({ pageBlocks, direction = 'vertical', className, propName, pageBlockId }: SlotProps) {
export default function Slot({ defaultValue, direction = 'vertical', className, propName, pageBlockId }: SlotProps) {
const { activePage } = usePageContent();
const { blocks: builderBlocks } = useProjectConfigurationState();
const { blocks: liveBlocks, globalBlocks } = usePageContentState();
const isBuilderMode = getProjectMode() === 'BUILDER';

if (pageBlocks.length === 0 && activePage) {
if (defaultValue.length === 0 && activePage) {
return (
<EmptyPageDroppable
activePage={activePage}
Expand All @@ -40,7 +40,7 @@ export default function Slot({ pageBlocks, direction = 'vertical', className, pr
if (!isBuilderMode) {
return (
<div className={cn(divClass)}>
{pageBlocks?.map((block) => {
{defaultValue?.map((block) => {
const globalBlock = globalBlocks?.find((b) => b.id === block?.globalBlockId);
const Block = blocks.find((b) => b.Schema.id === (globalBlock?.blockId || block.blockId));
if (!Block) return null;
Expand All @@ -56,7 +56,7 @@ export default function Slot({ pageBlocks, direction = 'vertical', className, pr
}
return (
<div className={cn(divClass)}>
{pageBlocks.map((pageBlock, index) => {
{defaultValue.map((pageBlock, index) => {
const { blockId } = pageBlock;
const block = blocks.find((block) => block.Schema.id === blockId);

Expand All @@ -70,7 +70,7 @@ export default function Slot({ pageBlocks, direction = 'vertical', className, pr
block={block}
index={index}
pageBlock={pageBlock}
pageBlocks={pageBlocks}
pageBlocks={defaultValue}
/>
);
})}
Expand Down

0 comments on commit eadb651

Please sign in to comment.