Update "new form" block action

This commit is contained in:
Michael Thomas 2022-02-17 21:34:14 -05:00
parent 5c96a82651
commit 054ceef45e
1 changed files with 15 additions and 6 deletions

View File

@ -9,7 +9,6 @@ import {
PanelRow, PanelRow,
ExternalLink, ExternalLink,
Button, Button,
Icon,
} from '@wordpress/components'; } from '@wordpress/components';
import { edit, external } from '@wordpress/icons'; import { edit, external } from '@wordpress/icons';
import { useState } from '@wordpress/element'; import { useState } from '@wordpress/element';
@ -75,19 +74,29 @@ const Edit: React.FC<BlockEditProps<IBlockAttributes>> = ( { attributes, setAttr
/> />
</div> </div>
: :
// No form has been selected yet, so render the placeholder // No form has been selected yet, so render the placeholder.
<div> <div>
<Placeholder <Placeholder
icon={ CogIcon } icon={ CogIcon }
label="Cognito Forms" label="Cognito Forms"
instructions="Choose an existing form to embed or create a new one." instructions="Choose an existing form to embed or create a new one."
> >
<div> <div style={ { display: 'flex' } }>
<Button isPrimary onClick={ () => setSelectDialogOpen( true ) }> <Button
variant="primary"
onClick={ () => setSelectDialogOpen( true ) }
>
Select Form Select Form
</Button> </Button>
<Button isTertiary href={ `${ baseUrl }/forms/new` } target="_blank"> <Button
New Form&thinsp;<Icon icon={ external } size={ 16 }></Icon> href={ `${ baseUrl }/forms/new` }
target="_blank"
icon={ external }
iconPosition="right"
iconSize={ 16 }
variant="secondary"
>
New Form
</Button> </Button>
</div> </div>
</Placeholder> </Placeholder>