import { BaseControl } from '@wordpress/components'; import { sprintf, __ } from '@wordpress/i18n'; import { Attributes } from '../../types'; import { Headlights } from './headers/Headlights'; import { HeadlightsMuted } from './headers/HeadlightsMuted'; import { HeadlightsMutedAlt } from './headers/HeadlightsMutedAlt'; import { SimpleString } from './headers/SimpleString'; type HeaderSelectProps = { attributes: Attributes; onClick: (slug: string) => void; }; export const HeaderSelect = ({ attributes, onClick }: HeaderSelectProps) => { const { headerType, bgColor } = attributes; const types = { none: __('None', 'code-block-pro'), headlights: __('Headlights', 'code-block-pro'), headlightsMuted: __('Headlights muted', 'code-block-pro'), headlightsMutedAlt: __('Headlights muted alt', 'code-block-pro'), simpleString: __('Simple string', 'code-block-pro'), }; const attributesWithoutHeaderType = { ...attributes, } as Partial; delete attributesWithoutHeaderType.headerType; return (
{Object.entries(types).map(([slug, type]) => ( ))}
); }; export const HeaderType = (attributes: Partial) => { const { headerType } = attributes; if (headerType === 'headlights') { return ; } if (headerType === 'headlightsMuted') { return ; } if (headerType === 'headlightsMutedAlt') { return ; } if (headerType === 'simpleString') { return ; } return null; };