Add template actions menu toggle with dummy reset template action

[MAILPOET-6336]
This commit is contained in:
Rostislav Wolny
2024-12-03 11:30:16 +01:00
committed by Rostislav Wolný
parent 9ebcf9b506
commit ebefee4de7
2 changed files with 47 additions and 6 deletions

View File

@ -48,6 +48,20 @@
span {
font-size: 13px;
}
p:last-child {
margin-bottom: 0;
}
}
.mailpoet-email-type-info__content_heading {
display: flex;
div:last-child {
margin-left: auto;
margin-right: -8px;
margin-top: -6px;
}
}
}

View File

@ -1,7 +1,13 @@
import { Panel, PanelBody, PanelRow } from '@wordpress/components';
import {
Panel,
PanelBody,
PanelRow,
DropdownMenu,
MenuItem,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { Icon, layout } from '@wordpress/icons';
import { Icon, layout, moreVertical } from '@wordpress/icons';
import { storeName } from '../../store';
export function TemplateInfo() {
@ -20,10 +26,31 @@ export function TemplateInfo() {
<Icon icon={ layout } />
</span>
<div className="mailpoet-email-type-info__content">
<h2>
{ /* @ts-expect-error Todo template type is not defined */ }
{ template?.title || __( 'Template', 'mailpoet' ) }
</h2>
<div className="mailpoet-email-type-info__content_heading">
<h2>
{ /* @ts-expect-error Todo template type is not defined */ }
{ template?.title ||
__( 'Template', 'mailpoet' ) }
</h2>
<DropdownMenu
icon={ moreVertical }
label={ __( 'Template actions', 'mailpoet' ) }
>
{ ( { onClose } ) => (
<MenuItem
onClick={ () => {
onClose();
} }
info={ __(
'Reset to default to clear all customizations',
'mailpoet'
) }
>
{ __( 'Reset', 'mailpoet' ) }
</MenuItem>
) }
</DropdownMenu>
</div>
{ description && <p>{ description || '' }</p> }
<p>
{ __(