Update "Start from scratch" button styles when no template is registered

MAILPOET-6333
This commit is contained in:
Oluwaseun Olorunsola
2024-12-02 15:09:09 +01:00
committed by Rostislav Wolný
parent 46c8ae94bc
commit abf03d6cc7

View File

@ -20,6 +20,8 @@ const BLANK_TEMPLATE = 'email-general';
export function SelectTemplateModal( { onSelectCallback } ) { export function SelectTemplateModal( { onSelectCallback } ) {
const [ templates ] = usePreviewTemplates(); const [ templates ] = usePreviewTemplates();
const hasTemplates = templates?.length > 0;
const handleTemplateSelection = ( template: TemplatePreview ) => { const handleTemplateSelection = ( template: TemplatePreview ) => {
void dispatch( editorStore ).resetEditorBlocks( void dispatch( editorStore ).resetEditorBlocks(
template.patternParsed template.patternParsed
@ -118,10 +120,12 @@ export function SelectTemplateModal( { onSelectCallback } ) {
) ) } ) ) }
</div> </div>
<Flex justify="flex-end"> <Flex justify={ hasTemplates ? 'flex-end' : 'center' }>
<FlexItem> <FlexItem>
<Button <Button
variant="tertiary" variant={
hasTemplates ? 'tertiary' : 'primary'
}
onClick={ () => handleCloseWithoutSelection() } onClick={ () => handleCloseWithoutSelection() }
> >
{ __( 'Start from scratch', 'mailpoet' ) } { __( 'Start from scratch', 'mailpoet' ) }