import { useDroppable } from '@dnd-kit/core'; import { SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; import { Button } from '@wordpress/components'; import BlockConfigurator from './BlockConfigurator'; function SortableBlock( { block, definition, dispatch } ) { const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable( { id: block.id, data: { type: 'canvas-block' }, } ); const style = { transform: CSS.Transform.toString( transform ), transition, opacity: isDragging ? 0.5 : 1, }; return (
{ definition?.label || block.block_type }
); } export default function BuilderCanvas( { blocks, definitions, dispatch } ) { const { setNodeRef, isOver } = useDroppable( { id: 'canvas' } ); return (

Builder Canvas

{ blocks.length === 0 ? (

Drag content blocks here to build your tool

) : ( b.id ) } strategy={ verticalListSortingStrategy } > { blocks.map( ( block ) => ( ) ) } ) }
); }