Skip to content

Commit

Permalink
Adds upgrade nudge UI
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Dec 5, 2019
1 parent c015617 commit 70aee31
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* WordPress dependencies
*/
import ServerSideRender from '@wordpress/server-side-render';
import { Fragment } from '@wordpress/element';
import { Fragment, useState } from '@wordpress/element';
import { compose } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
import {
Expand All @@ -17,7 +17,7 @@ import {
withColors,
withFontSizes,
} from '@wordpress/block-editor';
import { PanelBody } from '@wordpress/components';
import { PanelBody, Notice } from '@wordpress/components';
import { withSelect } from '@wordpress/data';

/**
Expand All @@ -35,12 +35,36 @@ const NavigationMenuEdit = ( {
textColor,
isPublished,
} ) => {
const [ upgradeNudgeVisible, setUpgradeNudgeVisible ] = useState( true );

const { customFontSize, textAlign } = attributes;

const actualFontSize = customFontSize || fontSize.size;

const upgradeBlock = () => {};

return (
<Fragment>
{ upgradeNudgeVisible && (
<Notice
onRemove={ () => setUpgradeNudgeVisible( false ) }
actions={ [
{
label: __( 'Upgrade Block', 'full-site-editing' ),
onClick: upgradeBlock,
},
] }
>
<p>
<span className="posts-list__message">
{ __(
'An improved version of the Navigation block is available. Upgrade for a better, more natural way to manage your Navigation.',
'full-site-editing'
) }
</span>
</p>
</Notice>
) }
<BlockControls>
<AlignmentToolbar
value={ textAlign }
Expand Down

0 comments on commit 70aee31

Please sign in to comment.