/** * Predefined header templates. * * Each template is a ready-made row/column layout applied to the currently * selected device's canvas (overwriting it). The free theme ships three; more * are planned for Pro, so the list is kept as plain data that a Pro build can * extend or replace. */ import { __ } from '@wordpress/i18n'; import { uid, type HeaderRow, type ColumnAlign } from './canvas-model'; export interface HeaderTemplate { id: string; label: string; description: string; /** Schematic column layout for the preview, per row. */ preview: ColumnAlign[][]; build: () => HeaderRow[]; } /** * Build a row from a list of columns described as [align, elements]. * @param cols Column descriptors. */ const row = ( cols: Array< [ ColumnAlign, string[] ] > ): HeaderRow => ( { id: uid( 'row' ), general: { enabled: true, content_width: 'contained', vertical_align: 'center', }, design: {}, columns: cols.map( ( [ align, elements ] ) => ( { id: uid( 'col' ), align, width: 0, elements, } ) ), } ); export const HEADER_TEMPLATES: HeaderTemplate[] = [ { id: 'right-aligned-nav', label: __( 'With right-aligned nav', 'aureon' ), description: __( 'Logo on the left; navigation and the account link pushed together to the right. The default layout.', 'aureon' ), preview: [ [ 'left', 'right', 'right' ] ], build: () => [ row( [ [ 'left', [ 'logo' ] ], [ 'right', [ 'primary-menu', 'account' ] ], ] ), ], }, { id: 'left-aligned-nav', label: __( 'With left-aligned nav', 'aureon' ), description: __( 'Logo on the left with the navigation beside it; the account link sits on the far right.', 'aureon' ), preview: [ [ 'left', 'left', 'right' ] ], build: () => [ row( [ [ 'left', [ 'logo', 'primary-menu' ] ], [ 'right', [ 'account' ] ], ] ), ], }, { id: 'centered-logo', label: __( 'With centered logo', 'aureon' ), description: __( 'Navigation on the left, the logo centered, and the account link on the right.', 'aureon' ), preview: [ [ 'left', 'center', 'right' ] ], build: () => [ row( [ [ 'left', [ 'primary-menu' ] ], [ 'center', [ 'logo' ] ], [ 'right', [ 'account' ] ], ] ), ], }, ];