/** * Layout section — the site-wide container / width / sidebar / section spacing * defaults. Per-view overrides of these live in the Content Templates * workspace (see sections/templates.tsx), which writes to layout.contexts.*. */ import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { RangeControl } from '@wordpress/components'; import { LayoutGrid, Maximize, Square, StretchHorizontal, Rows3, RectangleHorizontal, Ban, ArrowUp, Layers, SquareDashed, Hash, SquareStack, ArrowLeftRight, } from '../icons'; import type { LucideIcon } from '../icons'; import Tabs, { TabPanel } from '../controls/tabs'; import SelectField from '../controls/select-field'; import OptionCards from '../controls/option-cards'; import TickSlider from '../controls/tick-slider'; import type { WorkingSettings, SetPath } from '../types'; import SectionIntro from '../controls/section-intro'; const ID_PREFIX = 'aureon-layout'; const TABS = [ { key: 'container', label: __( 'Container', 'aureon' ), icon: RectangleHorizontal, }, { key: 'content', label: __( 'Content', 'aureon' ), icon: Rows3 }, ]; const CONTAINER_ICONS: Record< string, LucideIcon > = { full: Maximize, boxed: Square, narrow: StretchHorizontal, fluid: LayoutGrid, }; const CARD_HOVER_ICONS: Record< string, LucideIcon > = { none: Ban, lift: ArrowUp, shadow: Layers, border: SquareDashed, }; const PAGINATION_ICONS: Record< string, LucideIcon > = { numbered: Hash, buttons: SquareStack, simple: ArrowLeftRight, }; interface LayoutOption { value: string; label: string; description?: string; glyph?: string; } interface LayoutSchema { label: string; containers?: LayoutOption[]; content_styles?: LayoutOption[]; sidebars?: LayoutOption[]; spacings?: LayoutOption[]; card_hovers?: LayoutOption[]; pagination_styles?: LayoutOption[]; } interface LayoutData { container?: string; content_width?: number; content_style?: string; sidebar?: string; section_spacing?: string; card_hover?: string; pagination_style?: string; } interface LayoutSectionProps { schema?: LayoutSchema; working: WorkingSettings; setPath: SetPath; } export default function LayoutSection( { schema, working, setPath, }: LayoutSectionProps ) { const [ activeTab, setActiveTab ] = useState( 'container' ); if ( ! schema ) { return null; } const layout = ( working?.layout ?? {} ) as LayoutData; const toOptions = ( list?: LayoutOption[] ) => ( list ?? [] ).map( ( item ) => ( { label: item.label, value: item.value, } ) ); const toCards = ( list: LayoutOption[] | undefined, icons: Record< string, LucideIcon > ) => ( list ?? [] ).map( ( item ) => ( { label: item.label, value: item.value, description: item.description, icon: icons[ item.value ], } ) ); return (

{ schema.label }

{ __( 'Global container, content width, and section spacing for your site.', 'aureon' ) }

setPath( 'layout.container', value ) } /> { 'boxed' === ( layout.container ?? 'boxed' ) && ( setPath( 'layout.content_width', value ) } /> ) } setPath( 'layout.content_style', value ) } help={ __( 'Boxed wraps content in a surface card; Unboxed removes card chrome for flush, full-bleed content.', 'aureon' ) } />
setPath( 'layout.section_spacing', value ) } help={ __( 'The default spacing between sections and elements.', 'aureon' ) } />
setPath( 'layout.card_hover', value ) } help={ __( 'How cards react on hover across the site — blog posts, shop products, and more.', 'aureon' ) } />
setPath( 'layout.pagination_style', value ) } help={ __( 'The pagination control on every paginated listing — blog, archives, search results, and the product catalog.', 'aureon' ) } />
); }