Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posts List: Use Notice component for nudge #38218

Merged
merged 1 commit into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
div.posts-list__notice {
margin: 0 0 5px;

p {
.components-notice__content {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 13px;
margin: 1em 0;
padding: 2px;

.posts-list__message {
margin-right: 1em;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getPossibleBlockTransformations,
} from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import { Placeholder, RangeControl, PanelBody, Button } from '@wordpress/components';
import { Placeholder, RangeControl, PanelBody, Notice } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/block-editor';
import { select, dispatch } from '@wordpress/data';
Expand Down Expand Up @@ -60,19 +60,21 @@ registerBlockType( metadata.name, {
return (
<Fragment>
{ canBeUpgraded && (
<div className="posts-list__notice notice notice-info notice-alt">
<p>
<span className="posts-list__message">
{ __(
'An improved version of this block is available. Upgrade for a better, more natural way to manage your blog post listings.',
'full-site-editing'
) }
</span>
<Button isButton isLarge isDefault onClick={ upgradeBlock }>
{ __( 'Upgrade Block', 'full-site-editing' ) }
</Button>
</p>
</div>
<Notice
actions={ [
{
label: __( 'Upgrade Block', 'full-site-editing' ),
onClick: upgradeBlock,
},
] }
className="posts-list__notice"
isDismissible={ false }
>
{ __(
'An improved version of this block is available. Upgrade for a better, more natural way to manage your blog post listings.',
'full-site-editing'
) }
</Notice>
) }
<Placeholder
icon={ icon }
Expand Down