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

Tweak switcher to not scale icons down #9310

Merged
merged 6 commits into from
Aug 30, 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
2 changes: 2 additions & 0 deletions packages/editor/src/components/block-inspector/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@
.editor-block-inspector__card .editor-block-icon {
margin-left: -2px;
margin-right: 10px;
padding: 0 3px;
height: $icon-button-size-small;
}
1 change: 1 addition & 0 deletions packages/editor/src/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class BlockSwitcher extends Component {
onKeyDown={ openOnArrowDown }
>
<BlockIcon icon={ blockType.icon && blockType.icon.src } showColors />
<svg role="img" aria-hidden="true" focusable="false" className="editor-block-switcher__transform" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 8.9c.6-.6 1.4-.9 2.2-.9h6.9l-1.3 1.3 1.4 1.4L19.4 7l-3.7-3.7-1.4 1.4L15.6 6H8.7c-1.4 0-2.6.5-3.6 1.5l-2.8 2.8 1.4 1.4 2.8-2.8zm13.8 2.4l-2.8 2.8c-.6.6-1.3.9-2.1.9h-7l1.3-1.3-1.4-1.4L4.6 16l3.7 3.7 1.4-1.4L8.4 17h6.9c1.3 0 2.6-.5 3.5-1.5l2.8-2.8-1.3-1.4z" /></svg>
</IconButton>
</Toolbar>
);
Expand Down
53 changes: 41 additions & 12 deletions packages/editor/src/components/block-switcher/style.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
.editor-block-switcher {
position: relative;
height: $icon-button-size;
}

// Style this the same as the block buttons in the library.
// Needs specificiity to override the icon button.
.components-icon-button.editor-block-switcher__toggle {
width: auto;
margin: 0;
padding: 6px;
display: block;
height: $icon-button-size;
padding: 6px 3px;

// Unset icon button styles.
&:active,
Expand All @@ -19,28 +22,54 @@
border: none;
}

.editor-block-icon {
background: $light-gray-200;
.editor-block-icon,
.editor-block-switcher__transform {
width: $icon-button-size + 3px + 3px;
position: relative;
height: $icon-button-size-small;
margin: 0;
padding: 0 6px;
display: flex;
align-items: center;
transition: all 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);
}

svg {
height: 21px;
width: 21px;
}
// Add a dropdown arrow indicator.
.editor-block-icon::after {
content: "";
pointer-events: none;
display: block;
position: absolute;
top: $icon-button-size-small / 2 - 1px;
width: 0;
height: 0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 5px solid currentColor;
right: 6px;
}

.editor-block-switcher__transform {
margin-top: 6px + 3px;
border-radius: $radius-round-rectangle;
height: $icon-button-size-small + 6px;
padding: 3px 9px 3px 9px;
}

// Block hover style.
&:not(:disabled):hover .editor-block-icon {
@include block-style__hover();
// Block hover and focus style.
&[aria-expanded="true"] .editor-block-icon,
&[aria-expanded="true"] .editor-block-switcher__transform,
&:not(:disabled):hover .editor-block-icon,
&:not(:disabled):hover .editor-block-switcher__transform,
&:not(:disabled):focus .editor-block-icon,
&:not(:disabled):focus .editor-block-switcher__transform {
transform: translateY(-$icon-button-size);
}

// Block focus style.
&:not(:disabled):focus .editor-block-icon {
@include block-style__focus-active();
&:not(:disabled):focus .editor-block-icon,
&:not(:disabled):focus .editor-block-switcher__transform {
@include formatting-button-style__focus();
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/block-types-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
border: $border-width solid transparent;
transition: all 0.05s ease-in-out;
position: relative;
float: left; // This shouldn't be necessary, but without it, IE11 mangles margins.

&:disabled {
@include block-style__disabled();
Expand Down