import React, { CSSProperties } from 'react'; import { useEditor } from '@craftjs/core'; import { IMAGE_RADIUS_PRESETS, } from '../../../constants/presets'; import { StylePanelProps, SectionLabel, PresetButtonGrid, TextInputField, useNodeProp, } from './shared'; import { AssetPicker } from '../../../ui/AssetPicker'; import { PLACEHOLDER_SRC } from '../../../components/media/ImageBlock'; /* ---------- IMAGE (with upload/browse/drop) ---------- */ export const ImageStylePanel: React.FC = ({ selectedId, nodeProps }) => { const { actions } = useEditor(); const style: CSSProperties = nodeProps.style || {}; const { setPropStyle } = useNodeProp(selectedId); const maxWidthPresets = [ { label: '25%', value: '25%' }, { label: '50%', value: '50%' }, { label: '75%', value: '75%' }, { label: '100%', value: '100%' }, ]; return ( <> {/* Image source */}
Image Source actions.setProp(selectedId, (props: any) => { props.src = url || PLACEHOLDER_SRC; })} variant="full" />
{/* Alt Text */} { actions.setProp(selectedId, (props: any) => { props.alt = v; }); }} /> {/* Border Radius */}
Border Radius setPropStyle('borderRadius', v)} />
{/* Max Width */}
Max Width setPropStyle('maxWidth', v)} />
); };