/** * Row settings window — General (visibility, sticky/transparent, content * width, vertical alignment) and Style (background, border, spacing) tabs, * with Clear / Reset / Delete in the footer. * * Renders its own window (see BuilderModal). All values write back through * granular patch callbacks onto the row. */ import { __ } from '@wordpress/i18n'; import { useState } from '@wordpress/element'; import { Button } from '@wordpress/components'; import { AlignVerticalJustifyCenter, AlignVerticalJustifyEnd, AlignVerticalJustifyStart, Eraser, RotateCcw, Rows3, Trash2, } from 'lucide-react'; import BuilderModal, { BuilderToggleRow } from './builder-modal'; import Segmented from './segmented'; import RowDesignFields from './row-design-fields'; import type { HeaderRow, RowGeneral, RowDesign, ContentWidth, VerticalAlign, } from './canvas-model'; interface RowSettingsProps { row: HeaderRow; /** The row's name, e.g. "Main Header". */ title: string; hasItems: boolean; canDelete: boolean; /** Whether the zone offers sticky/transparent rows (header only). */ showFlags?: boolean; onGeneral: ( patch: Partial< RowGeneral > ) => void; onDesign: ( patch: Partial< RowDesign > ) => void; onClearRow: () => void; /** Omit where rows are fixed slots (the header dock) — hides the action. */ onDeleteRow?: () => void; /** Restore the row's settings (general, style, column widths/styles). */ onResetRow?: () => void; onClose: () => void; } export default function RowSettings( { row, title, hasItems, canDelete, showFlags = true, onGeneral, onDesign, onClearRow, onDeleteRow, onResetRow, onClose, }: RowSettingsProps ) { const general = row.general ?? { enabled: true }; const design: RowDesign = row.design ?? {}; const [ tab, setTab ] = useState( 'general' ); return ( { onResetRow && ( ) } { onDeleteRow && ( ) } } footerEnd={ } > { 'general' === tab && ( <>
onGeneral( { enabled } ) } /> { showFlags && ( onGeneral( { sticky } ) } /> ) } { showFlags && ( onGeneral( { transparent } ) } /> ) }
label={ __( 'Content width', 'aureon' ) } value={ general.content_width ?? 'contained' } options={ [ { value: 'contained', label: __( 'Contained', 'aureon' ), }, { value: 'full', label: __( 'Full width', 'aureon' ), }, ] } onChange={ ( value ) => onGeneral( { content_width: value } ) } /> label={ __( 'Vertical alignment', 'aureon' ) } value={ general.vertical_align ?? 'center' } options={ [ { value: 'top', label: __( 'Top', 'aureon' ), icon: AlignVerticalJustifyStart, }, { value: 'center', label: __( 'Middle', 'aureon' ), icon: AlignVerticalJustifyCenter, }, { value: 'bottom', label: __( 'Bottom', 'aureon' ), icon: AlignVerticalJustifyEnd, }, ] } onChange={ ( value ) => onGeneral( { vertical_align: value } ) } /> ) } { 'style' === tab && ( ) }
); }