generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ce5641
commit bfccb92
Showing
6 changed files
with
143 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,51 @@ | ||
import React from 'react'; | ||
import { RenderBlocks } from '@plone/volto/components'; | ||
import { useLocation } from 'react-router-dom'; | ||
import BlockEdit from '@plone/volto/components/manage/Blocks/Block/Edit'; | ||
import NewBlockAddButton from './NewBlockAddButton'; | ||
|
||
const style = { | ||
zIndex: '101', | ||
position: 'relative', | ||
}; | ||
|
||
export default function BlockContainer(props) { | ||
return null; | ||
// console.log('block container', props); | ||
const { mode, block, data, onChangeSlotfill, onDeleteSlotfill } = props; | ||
const location = useLocation(); | ||
const content = { | ||
blocks: { [block]: data }, | ||
blocks_layout: { items: [block] }, | ||
}; | ||
const metadata = {}; | ||
const index = 0; | ||
return ( | ||
<div className="aboveSearchblockOverlay" style={style}> | ||
{mode === 'view' ? ( | ||
<RenderBlocks | ||
content={content} | ||
metadata={metadata} | ||
location={location} | ||
/> | ||
) : data ? ( | ||
<BlockEdit | ||
id={block} | ||
block={block} | ||
data={data} | ||
type={data['@type']} | ||
properties={metadata} | ||
selected={false} | ||
multiSelected={false} | ||
onMoveBlock={() => {}} | ||
onDeleteBlock={() => {}} | ||
onChangeBlock={onChangeSlotfill} | ||
index={index} | ||
/> | ||
) : ( | ||
<div> | ||
<NewBlockAddButton block={block} onMutateBlock={onChangeSlotfill} /> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters