Spaces:
Running
Running
File size: 22,553 Bytes
d081604 ce2d6ca 27653a8 2595e43 ce2d6ca 2595e43 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 ce2d6ca 2595e43 27653a8 ce2d6ca d081604 ce2d6ca 27653a8 ce2d6ca 27653a8 ce2d6ca d081604 27653a8 ce2d6ca 27653a8 ce2d6ca 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 ce2d6ca d081604 ce2d6ca d081604 ce2d6ca 27653a8 ce2d6ca 27653a8 ce2d6ca 27653a8 d081604 27653a8 2595e43 d081604 27653a8 d081604 ce2d6ca 27653a8 d081604 27653a8 ce2d6ca 27653a8 ce2d6ca d081604 27653a8 d081604 27653a8 ce2d6ca d081604 27653a8 ce2d6ca d081604 27653a8 ce2d6ca 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 ce2d6ca d081604 ce2d6ca 2595e43 d081604 27653a8 d081604 27653a8 d081604 27653a8 2595e43 27653a8 d081604 27653a8 2595e43 d081604 27653a8 2595e43 27653a8 2595e43 27653a8 2595e43 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 27653a8 d081604 ce2d6ca 2595e43 d081604 ce2d6ca d081604 ce2d6ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | import { useState, useCallback } from 'react';
import { VisualElement } from '../../types/blocks';
import { useEditorStore } from '../../store/editorStore';
import {
Plus, Trash2, Palette, Type, Move, Square,
Bold, Italic, AlignLeft, AlignCenter, AlignRight,
MousePointer, EyeOff, Maximize2, Grid3X3, Play, RotateCcw,
Underline, Strikethrough
} from 'lucide-react';
interface PropertyPanelProps {
element: VisualElement | null;
}
// Spacing quick buttons
const SPACING_PRESETS = ['0', '4px', '8px', '12px', '16px', '24px', '32px', '48px'];
const RADIUS_PRESETS = [
{ label: 'None', value: '0' }, { label: 'Small', value: '4px' },
{ label: 'Medium', value: '8px' }, { label: 'Large', value: '16px' },
{ label: 'Round', value: '50%' },
];
interface CatProp {
key: string; label: string; type: string;
options?: { label: string; value: string }[]; suffix?: string;
}
const CSS_CATEGORIES: { name: string; icon: any; properties: CatProp[] }[] = [
{
name: 'Colors', icon: Palette, properties: [
{ key: 'backgroundColor', label: 'Background', type: 'color' },
{ key: 'color', label: 'Text Color', type: 'color' },
{ key: 'opacity', label: 'Opacity', type: 'number', suffix: '' },
]
},
{
name: 'Text', icon: Type, properties: [
{ key: 'fontSize', label: 'Size', type: 'px', suffix: 'px' },
{ key: 'fontWeight', label: 'Weight', type: 'select', options: [
{ label: 'Normal', value: 'normal' }, { label: 'Bold', value: 'bold' },
{ label: 'Light', value: '300' }, { label: 'Medium', value: '500' },
{ label: 'Semi Bold', value: '600' }, { label: 'Black', value: '900' },
]},
{ key: 'fontFamily', label: 'Font', type: 'select', options: [
{ label: 'Default', value: '' }, { label: 'Arial', value: 'Arial, sans-serif' },
{ label: 'Georgia', value: 'Georgia, serif' }, { label: 'Verdana', value: 'Verdana, sans-serif' },
{ label: 'Monospace', value: "'Courier New', monospace" },
]},
{ key: 'textAlign', label: 'Align', type: 'select', options: [
{ label: 'Left', value: 'left' }, { label: 'Center', value: 'center' }, { label: 'Right', value: 'right' },
]},
{ key: 'lineHeight', label: 'Line Height', type: 'number', suffix: '' },
{ key: 'letterSpacing', label: 'Letter Space', type: 'px', suffix: 'px' },
{ key: 'textDecoration', label: 'Decoration', type: 'select', options: [
{ label: 'None', value: 'none' }, { label: 'Underline', value: 'underline' },
{ label: 'Line Through', value: 'line-through' },
]},
]
},
{
name: 'Spacing & Size', icon: Move, properties: [
{ key: 'padding', label: 'All Padding', type: 'text', suffix: '' },
{ key: 'paddingTop', label: 'Padding Top', type: 'px', suffix: 'px' },
{ key: 'paddingBottom', label: 'Padding Bottom', type: 'px', suffix: 'px' },
{ key: 'paddingLeft', label: 'Padding Left', type: 'px', suffix: 'px' },
{ key: 'paddingRight', label: 'Padding Right', type: 'px', suffix: 'px' },
{ key: 'margin', label: 'All Margin', type: 'text', suffix: '' },
{ key: 'marginTop', label: 'Margin Top', type: 'px', suffix: 'px' },
{ key: 'marginBottom', label: 'Margin Bottom', type: 'px', suffix: 'px' },
{ key: 'marginLeft', label: 'Margin Left', type: 'px', suffix: 'px' },
{ key: 'marginRight', label: 'Margin Right', type: 'px', suffix: 'px' },
{ key: 'width', label: 'Width', type: 'text', suffix: '' },
{ key: 'height', label: 'Height', type: 'text', suffix: '' },
{ key: 'minWidth', label: 'Min Width', type: 'text', suffix: '' },
{ key: 'minHeight', label: 'Min Height', type: 'text', suffix: '' },
{ key: 'maxWidth', label: 'Max Width', type: 'text', suffix: '' },
{ key: 'maxHeight', label: 'Max Height', type: 'text', suffix: '' },
]
},
{
name: 'Layout', icon: Grid3X3, properties: [
{ key: 'display', label: 'Display', type: 'select', options: [
{ label: 'Default', value: '' }, { label: 'Block', value: 'block' },
{ label: 'Inline', value: 'inline' }, { label: 'Inline Block', value: 'inline-block' },
{ label: 'Flex', value: 'flex' }, { label: 'Grid', value: 'grid' },
{ label: 'None', value: 'none' },
]},
{ key: 'flexDirection', label: 'Flex Direction', type: 'select', options: [
{ label: 'Row', value: 'row' }, { label: 'Column', value: 'column' },
]},
{ key: 'justifyContent', label: 'Justify', type: 'select', options: [
{ label: 'Start', value: 'flex-start' }, { label: 'Center', value: 'center' },
{ label: 'End', value: 'flex-end' }, { label: 'Space Between', value: 'space-between' },
]},
{ key: 'alignItems', label: 'Align', type: 'select', options: [
{ label: 'Start', value: 'flex-start' }, { label: 'Center', value: 'center' },
{ label: 'End', value: 'flex-end' }, { label: 'Stretch', value: 'stretch' },
]},
{ key: 'gap', label: 'Gap', type: 'px', suffix: 'px' },
{ key: 'position', label: 'Position', type: 'select', options: [
{ label: 'Static', value: 'static' }, { label: 'Relative', value: 'relative' },
{ label: 'Absolute', value: 'absolute' }, { label: 'Fixed', value: 'fixed' },
{ label: 'Sticky', value: 'sticky' },
]},
{ key: 'top', label: 'Top', type: 'px', suffix: 'px' },
{ key: 'left', label: 'Left', type: 'px', suffix: 'px' },
{ key: 'right', label: 'Right', type: 'px', suffix: 'px' },
{ key: 'bottom', label: 'Bottom', type: 'px', suffix: 'px' },
{ key: 'overflow', label: 'Overflow', type: 'select', options: [
{ label: 'Visible', value: 'visible' }, { label: 'Hidden', value: 'hidden' },
{ label: 'Auto', value: 'auto' }, { label: 'Scroll', value: 'scroll' },
]},
]
},
{
name: 'Border & Rounding', icon: Square, properties: [
{ key: 'borderWidth', label: 'Border Width', type: 'px', suffix: 'px' },
{ key: 'borderStyle', label: 'Border Style', type: 'select', options: [
{ label: 'None', value: 'none' }, { label: 'Solid', value: 'solid' },
{ label: 'Dashed', value: 'dashed' }, { label: 'Dotted', value: 'dotted' },
]},
{ key: 'borderColor', label: 'Border Color', type: 'color' },
{ key: 'borderRadius', label: 'Round Corners', type: 'px', suffix: 'px' },
{ key: 'boxShadow', label: 'Shadow', type: 'select', options: [
{ label: 'None', value: 'none' }, { label: 'Small', value: '0 1px 3px rgba(0,0,0,0.12)' },
{ label: 'Medium', value: '0 4px 12px rgba(0,0,0,0.15)' },
{ label: 'Large', value: '0 10px 40px rgba(0,0,0,0.2)' },
{ label: 'Glow', value: '0 0 20px rgba(99,102,241,0.3)' },
]},
]
},
{
name: 'Effects', icon: EyeOff, properties: [
{ key: 'transition', label: 'Transition', type: 'select', options: [
{ label: 'None', value: 'none' }, { label: 'Fast', value: 'all 0.15s ease' },
{ label: 'Normal', value: 'all 0.3s ease' }, { label: 'Slow', value: 'all 0.5s ease' },
]},
{ key: 'transform', label: 'Transform', type: 'select', options: [
{ label: 'None', value: 'none' }, { label: 'Scale 1.1', value: 'scale(1.1)' },
{ label: 'Rotate 45°', value: 'rotate(45deg)' }, { label: 'Rotate 90°', value: 'rotate(90deg)' },
{ label: 'Flip X', value: 'scaleX(-1)' }, { label: 'Flip Y', value: 'scaleY(-1)' },
]},
{ key: 'cursor', label: 'Cursor', type: 'select', options: [
{ label: 'Default', value: 'default' }, { label: 'Pointer', value: 'pointer' },
{ label: 'Grab', value: 'grab' }, { label: 'Move', value: 'move' },
]},
]
},
];
export default function PropertyPanel({ element }: PropertyPanelProps) {
const { updateVisualElement, removeVisualElement, setSelectedElement } = useEditorStore();
const [expandedCat, setExpandedCat] = useState<string>('Colors');
const [addingToCat, setAddingToCat] = useState<string | null>(null);
if (!element) {
return (
<div className="p-4 text-center text-surface-400 text-sm">
<MousePointer className="w-8 h-8 mx-auto mb-2 opacity-50" />
<p>Select an element on the canvas</p>
<p className="text-xs mt-1">or in the element tree</p>
</div>
);
}
const updateProp = (key: string, value: any) =>
updateVisualElement(element.id, { props: { ...element.props, [key]: value } });
const updateStyle = (key: string, value: any) =>
updateVisualElement(element.id, { styles: { ...element.styles, [key]: value } });
const removeStyle = (key: string) => {
const { [key]: _, ...rest } = element.styles;
updateVisualElement(element.id, { styles: rest });
};
const updateAttribute = (key: string, value: any) =>
updateVisualElement(element.id, { attributes: { ...element.attributes, [key]: value } });
const activeStyles = new Set(Object.keys(element.styles || {}));
const addStyle = (key: string) => {
updateStyle(key, '');
setAddingToCat(null);
};
const renderStyleEditor = (prop: CatProp) => {
const value = (element.styles || {})[prop.key] ?? '';
return (
<div key={prop.key} className="flex items-center gap-1.5 group py-0.5">
{prop.type === 'color' ? (
<div className="flex items-center gap-1 flex-1 min-w-0">
<input type="color" value={value || '#000000'}
onChange={(e) => updateStyle(prop.key, e.target.value)}
className="w-6 h-6 rounded cursor-pointer border border-surface-600 p-0.5 flex-shrink-0" />
<input type="text" value={value} onChange={(e) => updateStyle(prop.key, e.target.value)}
className="flex-1 bg-transparent text-[11px] text-surface-300 outline-none min-w-0" placeholder={prop.label} />
</div>
) : prop.type === 'select' ? (
<select value={value} onChange={(e) => updateStyle(prop.key, e.target.value)}
className="flex-1 bg-surface-800 text-[11px] text-surface-300 rounded px-1.5 py-0.5 border border-surface-700 outline-none">
<option value="">--</option>
{(prop.options || []).map(o => (
<option key={o.value} value={o.value}>{o.label}</option>
))}
</select>
) : prop.type === 'px' ? (
<div className="flex items-center gap-1 flex-1">
<input type="number" value={parseInt(value) || ''}
onChange={(e) => updateStyle(prop.key, e.target.value ? `${e.target.value}px` : '')}
className="flex-1 bg-transparent text-[11px] text-surface-300 outline-none min-w-0" placeholder={prop.label}
min="0" />
<span className="text-[10px] text-surface-500 w-4">px</span>
</div>
) : (
<div className="flex items-center gap-1 flex-1">
<input type="text" value={value} onChange={(e) => updateStyle(prop.key, e.target.value)}
className="flex-1 bg-transparent text-[11px] text-surface-300 outline-none min-w-0" placeholder={prop.label} />
{prop.suffix && <span className="text-[10px] text-surface-500">{prop.suffix}</span>}
</div>
)}
<button onClick={() => removeStyle(prop.key)}
className="opacity-0 group-hover:opacity-100 p-0.5 text-red-400 hover:text-red-300 transition-opacity flex-shrink-0">
<Trash2 className="w-3 h-3" />
</button>
</div>
);
};
return (
<div className="p-3 space-y-3 text-sm overflow-y-auto">
{/* Element header */}
<div className="flex items-center justify-between border-b border-surface-700 pb-2">
<div>
<span className="text-xs font-medium text-primary-400 bg-primary-500/10 px-2 py-0.5 rounded">
<{element.tagName}>
</span>
<span className="text-[10px] text-surface-500 ml-2">
{element.props?.id ? `#${element.props.id}` : ''}
</span>
</div>
<button onClick={() => { removeVisualElement(element.id); setSelectedElement(null); }}
className="p-1 hover:bg-surface-700 rounded text-red-400"><Trash2 className="w-3.5 h-3.5" /></button>
</div>
{/* Quick element identity */}
<div className="grid grid-cols-2 gap-1.5">
<div>
<label className="text-[10px] text-surface-400 block mb-0.5">ID</label>
<input type="text" value={element.props?.id || ''} onChange={(e) => updateProp('id', e.target.value)}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none" placeholder="my-id" />
</div>
<div>
<label className="text-[10px] text-surface-400 block mb-0.5">Classes</label>
<input type="text" value={(element.classes || []).join(' ')} onChange={(e) =>
updateVisualElement(element.id, { classes: e.target.value.split(' ').filter(Boolean) })}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none" placeholder="class1 class2" />
</div>
</div>
{/* Text Content */}
{['p','h1','h2','h3','h4','h5','h6','span','a','button','label','li','strong','em','b','i','u','s','mark','figcaption','legend','summary','dt','dd','th','td','caption','option','blockquote','pre','code','abbr','cite','time','address'].includes(element.tagName) && (
<div className="border-t border-surface-700 pt-2">
<label className="text-[10px] text-surface-400 block mb-0.5">Text Content</label>
<textarea value={element.props?.textContent || ''} onChange={(e) => updateProp('textContent', e.target.value)}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-1 text-[11px] text-surface-200 outline-none resize-none h-12" />
</div>
)}
{/* Image/Link/Input-specific props */}
{element.tagName === 'img' && (
<div className="border-t border-surface-700 pt-2 space-y-1.5">
<label className="text-[10px] text-surface-400 block mb-0.5">Image URL</label>
<input type="text" value={element.props?.src || ''} onChange={(e) => updateProp('src', e.target.value)}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none" />
<label className="text-[10px] text-surface-400 block mb-0.5">Alt Text</label>
<input type="text" value={element.props?.alt || ''} onChange={(e) => updateProp('alt', e.target.value)}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none" />
</div>
)}
{element.tagName === 'a' && (
<div className="border-t border-surface-700 pt-2 space-y-1.5">
<label className="text-[10px] text-surface-400 block mb-0.5">Link URL</label>
<input type="text" value={element.props?.href || ''} onChange={(e) => updateProp('href', e.target.value)}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none" />
<div className="flex gap-2 items-center">
<select value={element.props?.target || '_self'} onChange={(e) => updateProp('target', e.target.value)}
className="flex-1 bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none">
<option value="_self">Same tab</option>
<option value="_blank">New tab</option>
</select>
</div>
</div>
)}
{element.tagName === 'input' && (
<div className="border-t border-surface-700 pt-2 space-y-1.5">
<label className="text-[10px] text-surface-400 block mb-0.5">Input Type</label>
<select value={element.props?.type || 'text'} onChange={(e) => updateProp('type', e.target.value)}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none">
{['text','number','email','password','date','color','file','checkbox','radio','range','tel','url','search'].map(t => (
<option key={t} value={t}>{t}</option>
))}
</select>
{!['checkbox','radio','color','range','file'].includes(element.props?.type || 'text') && (
<>
<label className="text-[10px] text-surface-400 block mb-0.5">Placeholder</label>
<input type="text" value={element.props?.placeholder || ''} onChange={(e) => updateProp('placeholder', e.target.value)}
className="w-full bg-surface-800 border border-surface-700 rounded px-1.5 py-0.5 text-[11px] text-surface-200 outline-none" />
</>
)}
<div className="flex items-center gap-3">
<label className="flex items-center gap-1.5">
<input type="checkbox" checked={element.props?.required || false} onChange={(e) => updateProp('required', e.target.checked)}
className="rounded bg-surface-700 border-surface-600 w-3 h-3" />
<span className="text-[11px] text-surface-400">Required</span>
</label>
<label className="flex items-center gap-1.5">
<input type="checkbox" checked={element.props?.disabled || false} onChange={(e) => updateProp('disabled', e.target.checked)}
className="rounded bg-surface-700 border-surface-600 w-3 h-3" />
<span className="text-[11px] text-surface-400">Disabled</span>
</label>
</div>
</div>
)}
{/* ===== CSS CATEGORIES WITH PLUS BUTTONS ===== */}
<div className="border-t border-surface-700 pt-2 space-y-1">
<h4 className="text-[10px] font-semibold text-surface-400 uppercase tracking-wider mb-1">CSS Styles</h4>
{CSS_CATEGORIES.map((cat) => {
const isOpen = expandedCat === cat.name;
const CatIcon = cat.icon;
const activeCount = cat.properties.filter(p => activeStyles.has(p.key)).length;
return (
<div key={cat.name} className="border border-surface-700/50 rounded-md">
{/* Category header */}
<button onClick={() => setExpandedCat(isOpen ? '' : cat.name)}
className="w-full flex items-center gap-1.5 px-2 py-1.5 bg-surface-800/50 hover:bg-surface-800 text-xs text-surface-300 transition-colors rounded-t-md">
<CatIcon className="w-3.5 h-3.5 text-surface-400" />
<span className="flex-1 text-left text-[11px] font-medium">{cat.name}</span>
{activeCount > 0 && <span className="text-[10px] bg-primary-500/20 text-primary-400 px-1.5 rounded-full">{activeCount}</span>}
</button>
{isOpen && (
<div className="px-2 py-1.5 space-y-1">
{/* Active properties */}
{cat.properties.filter(p => activeStyles.has(p.key)).map(p => renderStyleEditor(p))}
{/* Quick presets for Spacing */}
{cat.name === 'Spacing & Size' && activeStyles.has('padding') && (
<div className="flex flex-wrap gap-1 pt-1">
{SPACING_PRESETS.map(v => (
<button key={v} onClick={() => updateStyle('padding', v)}
className={`px-1.5 py-0.5 text-[10px] rounded transition-colors ${
(element.styles?.padding || '') === v ? 'bg-primary-600 text-white' : 'bg-surface-700 text-surface-300 hover:bg-surface-600'
}`}>{v}</button>
))}
</div>
)}
{/* Quick presets for border radius */}
{cat.name === 'Border & Rounding' && activeStyles.has('borderRadius') && (
<div className="flex flex-wrap gap-1 pt-1">
{RADIUS_PRESETS.map(r => (
<button key={r.value} onClick={() => updateStyle('borderRadius', r.value)}
className={`px-1.5 py-0.5 text-[10px] rounded transition-colors ${
(element.styles?.borderRadius || '') === r.value ? 'bg-primary-600 text-white' : 'bg-surface-700 text-surface-300 hover:bg-surface-600'
}`}>{r.label}</button>
))}
</div>
)}
{/* Add property button */}
<div className="relative pt-0.5">
<button onClick={() => setAddingToCat(addingToCat === cat.name ? null : cat.name)}
className="w-full flex items-center gap-1 px-2 py-1 rounded text-[10px] text-surface-500 hover:text-primary-400 hover:bg-surface-800 transition-colors">
<Plus className="w-3 h-3" /> Add property
</button>
{addingToCat === cat.name && (
<div className="mt-1 bg-surface-800 border border-surface-700 rounded-md shadow-xl max-h-36 overflow-y-auto">
{cat.properties.filter(p => !activeStyles.has(p.key)).map(p => (
<button key={p.key} onClick={() => addStyle(p.key)}
className="w-full text-left px-2 py-1 text-[11px] text-surface-300 hover:bg-surface-700 transition-colors">
{p.label}
</button>
))}
{cat.properties.filter(p => !activeStyles.has(p.key)).length === 0 && (
<div className="px-2 py-2 text-[10px] text-surface-500 italic text-center">All properties shown</div>
)}
</div>
)}
</div>
</div>
)}
</div>
);
})}
</div>
{/* Clear all */}
{activeStyles.size > 0 && (
<div className="flex gap-2 pt-1 border-t border-surface-700">
<button onClick={() => updateVisualElement(element.id, { styles: {} })}
className="flex-1 px-2 py-1 text-[10px] text-red-400 bg-red-500/10 rounded hover:bg-red-500/20 transition-colors">
Clear All Styles
</button>
</div>
)}
</div>
);
}
|