import React from 'react'; import { useEditor } from '@craftjs/core'; import { BG_COLORS, SPACING_PRESETS, RADIUS_PRESETS, } from '../../../constants/presets'; import { StylePanelProps, SectionLabel, ColorSwatchGrid, PresetButtonGrid, CollapsibleSection, ColorPickerField, ArrayPropEditor, labelStyle, inputStyle, smallInputStyle, sectionGap, useNodeProp, } from './shared'; import { AssetPicker } from '../../../ui/AssetPicker'; /* ---------- MEDIA (Video / Gallery / Map / Slider) ---------- */ export const MediaStylePanel: React.FC = ({ selectedId, nodeProps }) => { const { actions } = useEditor(); const { setProp, setPropStyle } = useNodeProp(selectedId); const style = nodeProps.style || {}; return ( <> {/* Video URL */} {nodeProps.videoUrl !== undefined && (
setProp('videoUrl', e.target.value)} placeholder="YouTube, Vimeo, or .mp4 URL" style={inputStyle} />
)} {/* Map URL */} {nodeProps.embedUrl !== undefined && nodeProps.videoUrl === undefined && (
setProp('embedUrl', e.target.value)} placeholder="Google Maps embed URL" style={inputStyle} />
)} {/* Map address */} {nodeProps.address !== undefined && (
setProp('address', e.target.value)} placeholder="123 Main St..." style={inputStyle} />
)} {/* Video options */} {nodeProps.autoplay !== undefined && (
)} {nodeProps.loop !== undefined && (
)} {nodeProps.controls !== undefined && (
)} {/* Gallery items */} {nodeProps.images !== undefined && Array.isArray(nodeProps.images) && ( (
{item.src !== undefined && ( { actions.setProp(selectedId, (props: any) => { const updated = [...(props.images || [])]; updated[index] = { ...updated[index], src: url }; props.images = updated; }); }} /> )} {item.caption !== undefined && ( { actions.setProp(selectedId, (props: any) => { const updated = [...(props.images || [])]; updated[index] = { ...updated[index], caption: e.target.value }; props.images = updated; }); }} placeholder="Caption" style={smallInputStyle} /> )}
)} emptyItem={{ src: '', caption: '' }} />
)} {/* Slides */} {nodeProps.slides !== undefined && Array.isArray(nodeProps.slides) && ( (
{item.heading !== undefined && ( { actions.setProp(selectedId, (props: any) => { const updated = [...(props.slides || [])]; updated[index] = { ...updated[index], heading: e.target.value }; props.slides = updated; }); }} placeholder="Heading" style={smallInputStyle} /> )} {item.text !== undefined && (