import { memo } from 'react'; export const PropertiesPanel = memo(function PropertiesPanel({ element, onUpdate, onDelete, onEditPhoto }) { if (!element) { return (

Properties

Select an element to edit its properties
); } const handlePositionChange = (axis, value) => { onUpdate({ [axis]: parseFloat(value) || 0 }); }; const handleSizeChange = (axis, value) => { const numValue = parseFloat(value) || 20; onUpdate({ [axis]: Math.max(20, numValue) }); }; const handleRotationChange = (value) => { const numValue = parseFloat(value) || 0; onUpdate({ rotation: Math.max(-180, Math.min(180, numValue)) }); }; return (

Properties

{/* Element type badge */}
{element.type}
{/* Position */}
handlePositionChange('x', e.target.value)} style={{ width: '100%', padding: '0.5rem', border: `1px solid var(--border)`, borderRadius: 'var(--radius-sm)', fontSize: '13px', }} />
handlePositionChange('y', e.target.value)} style={{ width: '100%', padding: '0.5rem', border: `1px solid var(--border)`, borderRadius: 'var(--radius-sm)', fontSize: '13px', }} />
{/* Size (for images and stickers) */} {(element.type === 'image' || element.type === 'sticker') && (
handleSizeChange('width', e.target.value)} style={{ width: '100%', padding: '0.5rem', border: `1px solid var(--border)`, borderRadius: 'var(--radius-sm)', fontSize: '13px', }} />
handleSizeChange('height', e.target.value)} style={{ width: '100%', padding: '0.5rem', border: `1px solid var(--border)`, borderRadius: 'var(--radius-sm)', fontSize: '13px', }} />
)} {/* Edit Photo button (for images only) */} {element.type === 'image' && onEditPhoto && (
)} {/* Font size (for text) */} {element.type === 'text' && ( <>
onUpdate({ fontSize: parseInt(e.target.value, 10) })} style={{ width: '100%' }} />
onUpdate({ fill: e.target.value })} style={{ width: '100%', height: '36px', border: `1px solid var(--border)`, borderRadius: 'var(--radius-sm)', cursor: 'pointer', padding: '2px', }} />
)} {/* Rotation */}
handleRotationChange(e.target.value)} style={{ width: '100%' }} />
{/* Delete button */}
); });