import React from 'react'; import { useDraggableComponent } from '../hooks/useDragDrop'; interface ComponentPaletteProps { onComponentSelect?: (componentType: string) => void; } const DraggableComponentItem: React.FC<{ componentType: string; icon?: string; label?: string; onSelect?: (type: string) => void; }> = ({ componentType, icon, label, onSelect }) => { const { drag, isDragging } = useDraggableComponent(componentType); return (
onSelect?.(componentType)} style={{ opacity: isDragging ? 0.5 : 1, cursor: 'move' }} > {icon && {icon}} {label || componentType}
); }; export const ComponentPalette: React.FC = ({ onComponentSelect, }) => { const components = [ { type: 'Button', icon: '🔘', label: 'Button' }, { type: 'Heading', icon: '📝', label: 'Heading' }, { type: 'Paragraph', icon: '📄', label: 'Paragraph' }, { type: 'Image', icon: '🖼️', label: 'Image' }, { type: 'Container', icon: '📦', label: 'Container' }, { type: 'Section', icon: '📑', label: 'Section' }, { type: 'Row', icon: '↔️', label: 'Row' }, { type: 'Column', icon: '↕️', label: 'Column' }, { type: 'Divider', icon: '➖', label: 'Divider' }, { type: 'Spacer', icon: '⬜', label: 'Spacer' }, ]; return (

Components

{components.map((comp) => ( ))}
); };