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

Update UI to better indicate that a block is reusable #5720

Merged
merged 1 commit into from
Mar 23, 2018
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
4 changes: 3 additions & 1 deletion blocks/library/block/edit-panel/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
font-family: $default-font;
font-size: $default-font-size;
justify-content: flex-end;
margin: $block-padding (-$block-padding) (-$block-padding);
margin: 0 (-$block-padding);
padding: 10px $block-padding;
position: relative;
top: $block-padding;

.reusable-block-edit-panel__spinner {
margin: 0 5px;
Expand Down
2 changes: 2 additions & 0 deletions blocks/library/block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { __ } from '@wordpress/i18n';
*/
import BlockEdit from '../../block-edit';
import ReusableBlockEditPanel from './edit-panel';
import ReusableBlockIndicator from './indicator';

class ReusableBlockEdit extends Component {
constructor( { reusableBlock } ) {
Expand Down Expand Up @@ -118,6 +119,7 @@ class ReusableBlockEdit extends Component {
onCancel={ this.stopEditing }
/>
) }
{ ! isSelected && ! isEditing && <ReusableBlockIndicator title={ reusableBlock.title } /> }
</Fragment>
);
}
Expand Down
22 changes: 22 additions & 0 deletions blocks/library/block/indicator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* WordPress dependencies
*/
import { Tooltip, Dashicon } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import './style.scss';

function ReusableBlockIndicator( { title } ) {
return (
<Tooltip text={ sprintf( __( 'Shared Block: %s' ), title ) }>
<span className="reusable-block-indicator">
<Dashicon icon="controls-repeat" />
</span>
</Tooltip>
);
}

export default ReusableBlockIndicator;
12 changes: 12 additions & 0 deletions blocks/library/block/indicator/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.reusable-block-indicator {
background: $white;
border-left: 1px dashed $light-gray-500;
color: $dark-gray-500;
border-top: 1px dashed $light-gray-500;
bottom: -$block-padding;
height: 30px;
padding: 5px;
position: absolute;
right: -$block-padding;
width: 30px;
}
30 changes: 15 additions & 15 deletions editor/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,12 @@
transition: opacity 0.2s;
}

&.is-reusable.is-selected > .editor-block-mover:before {
border-right: none;
}

&.is-selected > .editor-block-settings-menu:before,
&.is-hovered > .editor-block-settings-menu:before {
border-left: 1px solid $light-gray-500;
left: 6px;
}

&.is-reusable.is-selected > .editor-block-settings-menu:before {
border-left: none;
}


/**
* Selected Block style
*/
Expand All @@ -132,12 +123,6 @@
outline: 1px solid $light-gray-500;
}

// give reusable blocks a dashed outline
&.is-reusable.is-selected > .editor-block-list__block-edit:before {
outline: 1px dashed $light-gray-500;
}


/**
* Selection Style
*/
Expand All @@ -159,6 +144,21 @@
background: $blue-medium-highlight;
}

/**
* Reusable Block style
*/

&.is-reusable > .editor-block-mover:before {
border-right: none;
}

&.is-reusable > .editor-block-settings-menu:before {
border-left: none;
}

&.is-reusable > .editor-block-list__block-edit:before {
outline: 1px dashed $light-gray-500;
}

// @todo, this appears to be unused
.iframe-overlay {
Expand Down