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

Polish quick toolbar #2151

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion components/toolbar/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.components-toolbar {
margin: 0;
border: 1px solid $light-gray-500;
box-shadow: $shadow-popover;
//box-shadow: $shadow-toolbar;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented line?

background-color: $white;
display: inline-flex;
}
Expand Down
1 change: 1 addition & 0 deletions editor/assets/stylesheets/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ $admin-sidebar-width: 160px;
$admin-sidebar-width-big: 190px;
$admin-sidebar-width-collapsed: 36px;
$shadow-popover: 0px 3px 20px rgba( $dark-gray-900, .1 ), 0px 1px 3px rgba( $dark-gray-900, .1 );
$shadow-toolbar: 0px 2px 10px rgba( $dark-gray-900, .1 ), 0px 0px 2px rgba( $dark-gray-900, .1 );
$text-editor-max-width: 760px;
$button-focus-style: 0 0 0 1px $blue-medium-400, 0 0 2px 1px $blue-medium-400;

Expand Down
5 changes: 0 additions & 5 deletions editor/block-switcher/style.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
.editor-block-switcher {
border: 1px solid $light-gray-500;
box-shadow: $shadow-popover;
background-color: $white;
font-family: $default-font;
font-size: $default-font-size;
line-height: $default-line-height;
margin-right: -1px;

@include break-small() {
margin-right: $item-spacing;
}
}

.editor-block-switcher__toggle {
Expand Down
26 changes: 14 additions & 12 deletions editor/modes/visual-editor/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,19 +379,21 @@ class VisualEditorBlock extends Component {
component={ FirstChild }
>
<div className="editor-visual-editor__block-controls">
<BlockSwitcher uid={ block.uid } />
<Slot name="Formatting.Toolbar" />
<Toolbar className="editor-visual-editor__mobile-tools">
{ ( showUI || isHovered ) && <BlockMover uids={ [ block.uid ] } /> }
{ ( showUI || isHovered ) && <BlockRightMenu uid={ block.uid } /> }
<IconButton
className="editor-visual-editor__mobile-toggle"
onClick={ this.toggleMobileControls }
aria-expanded={ showMobileControls }
label={ __( 'Toggle extra controls' ) }
icon="ellipsis"
/>
<div className="editor-visual-editor__group">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need an extra div for this? From the screenshot it seems we can just remove some margins? Or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the drop shadow to a parent container, and that container has to wrap inline-block, and not be full width like the block controls container is.

But I agree it's not super elegant. I'll think about how this can be improved.

<BlockSwitcher uid={ block.uid } />
<Slot name="Formatting.Toolbar" />
<Toolbar className="editor-visual-editor__mobile-tools">
{ ( showUI || isHovered ) && <BlockMover uids={ [ block.uid ] } /> }
{ ( showUI || isHovered ) && <BlockRightMenu uid={ block.uid } /> }
<IconButton
className="editor-visual-editor__mobile-toggle"
onClick={ this.toggleMobileControls }
aria-expanded={ showMobileControls }
label={ __( 'Toggle extra controls' ) }
icon="ellipsis"
/>
</Toolbar>
</div>
</div>
</CSSTransitionGroup>
}
Expand Down
28 changes: 22 additions & 6 deletions editor/modes/visual-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
}

&.is-showing-mobile-controls {
.editor-visual-editor__block-controls > :not( .editor-visual-editor__mobile-tools ) {
.editor-visual-editor__group > :not( .editor-visual-editor__mobile-tools ) {
display: none;
}
.editor-visual-editor__mobile-tools {
Expand Down Expand Up @@ -304,6 +304,7 @@
// Larger viewports
@include break-small() {
margin-left: 0;
margin-right: auto;
}

@include break-medium() {
Expand All @@ -315,6 +316,24 @@
}
}

.editor-visual-editor__group {
display: inline-flex;
box-shadow: $shadow-toolbar;
width: 100%;
background: $white;
border-top: 1px solid $light-gray-500;
border-bottom: 1px solid $light-gray-500;

> * {
margin-top: -1px;
margin-bottom: -1px;
}

@include break-small() {
width: auto;
}
}

$sticky-bottom-offset: 20px;
.editor-visual-editor__block-controls + div {
// prevent collapsing margins between block and toolbar, matches the 20px bottom offset
Expand All @@ -327,11 +346,8 @@ $sticky-bottom-offset: 20px;

&.editor-visual-editor__mobile-tools {
margin-left: auto;
}

// Larger viewports
@include break-small() {
margin-right: $item-spacing;
margin-top: -1px;
margin-bottom: -1px;
}
}

Expand Down