Skip to content

Commit

Permalink
borders for dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 2, 2020
1 parent ec2a66f commit 2f5eab8
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function BlockConvertButton( { shouldRender, onClick, small } ) {
<MenuItem
className="block-editor-block-settings-menu__control"
onClick={ onClick }
icon="screenoptions"
>
{ ! small && label }
</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function BlockModeToggle( { blockType, mode, onToggleMode, small = false,
<MenuItem
className="block-editor-block-settings-menu__control"
onClick={ onToggleMode }
icon="html"
>
{ ! small && label }
</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import __experimentalBlockSettingsMenuPluginsExtension from './block-settings-me
const POPOVER_PROPS = {
className: 'block-editor-block-settings-menu__popover',
position: 'bottom right',
noArrow: true,
};

export function BlockSettingsMenu( { clientIds } ) {
Expand Down Expand Up @@ -62,6 +63,7 @@ export function BlockSettingsMenu( { clientIds } ) {
label={ __( 'More options' ) }
className="block-editor-block-settings-menu"
popoverProps={ POPOVER_PROPS }
noIcons
>
{ ( { onClose } ) => (
<>
Expand All @@ -83,7 +85,6 @@ export function BlockSettingsMenu( { clientIds } ) {
<MenuItem
className="block-editor-block-settings-menu__control"
onClick={ flow( onClose, onDuplicate ) }
icon="admin-page"
shortcut={ shortcuts.duplicate }
>
{ __( 'Duplicate' ) }
Expand All @@ -94,15 +95,13 @@ export function BlockSettingsMenu( { clientIds } ) {
<MenuItem
className="block-editor-block-settings-menu__control"
onClick={ flow( onClose, onInsertBefore ) }
icon="insert-before"
shortcut={ shortcuts.insertBefore }
>
{ __( 'Insert Before' ) }
</MenuItem>
<MenuItem
className="block-editor-block-settings-menu__control"
onClick={ flow( onClose, onInsertAfter ) }
icon="insert-after"
shortcut={ shortcuts.insertAfter }
>
{ __( 'Insert After' ) }
Expand All @@ -124,7 +123,6 @@ export function BlockSettingsMenu( { clientIds } ) {
<MenuItem
className="block-editor-block-settings-menu__control"
onClick={ flow( onClose, onRemove ) }
icon="trash"
shortcut={ shortcuts.remove }
>
{ _n( 'Remove Block', 'Remove Blocks', count ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
transform: rotate(90deg);
}

.block-editor-block-settings-menu__popover .components-popover__content {
margin-top: $grid-size;
}

.block-editor-block-settings-menu__popover .components-dropdown-menu__menu {
padding: 0;
}
6 changes: 5 additions & 1 deletion packages/components/src/dropdown-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function DropdownMenu( {
// The following props exist for backward compatibility.
menuLabel,
position,
noIcons,
} ) {
if ( menuLabel ) {
deprecated( '`menuLabel` prop in `DropdownComponent`', {
Expand Down Expand Up @@ -118,7 +119,10 @@ function DropdownMenu( {
renderContent={ ( props ) => {
const mergedMenuProps = mergeProps( {
'aria-label': menuLabel || label,
className: 'components-dropdown-menu__menu',
className: classnames(
'components-dropdown-menu__menu',
{ 'no-icons': noIcons }
),
}, menuProps );

return (
Expand Down
26 changes: 26 additions & 0 deletions packages/components/src/dropdown-menu/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,30 @@
margin-right: 4px;
}
}

.components-menu-group {
padding: $grid-size-large;
margin-top: 0;
margin-bottom: 0;
margin-left: -$grid-size-large;
margin-right: -$grid-size-large;

&:first-child {
margin-top: -$grid-size-large;
}

&:last-child {
margin-bottom: -$grid-size-large;
}
}

.components-menu-group + .components-menu-group {
margin-top: 0;
border-top: $border-width solid $border-color;
padding: $grid-size-large;
}
}

.components-dropdown-menu__menu.no-icons .components-menu-item__button.components-button {
padding: 0 $grid-size;
}
6 changes: 1 addition & 5 deletions packages/components/src/menu-group/style.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
.components-menu-group {
width: 100%;
}

.components-menu-group + .components-menu-group {
margin-top: $grid-size;
padding-top: $grid-size;
border-top: $border-width solid $light-gray-500;
border-top: $border-width solid $border-color;
}

.components-menu-group__label {
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/popover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $arrow-size: 8px;
margin-left: 2px;

&::before {
border: $arrow-size solid $light-gray-500;
border: $arrow-size solid $border-color;
}

&::after {
Expand Down Expand Up @@ -144,7 +144,7 @@ $arrow-size: 8px;

.components-popover__content {
box-shadow: $shadow-popover;
border: $border-width solid $light-gray-500;
border: $border-width solid $border-color;
background: $white;
height: 100%;

Expand All @@ -161,7 +161,7 @@ $arrow-size: 8px;
overflow-y: visible;
min-width: auto;
border: none;
border-top: $border-width solid $light-gray-500;
border-top: $border-width solid $border-color;
}

.components-popover[data-y-axis="top"] & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export function BlockInspectorButton( {
onClick();
}
} }
icon="admin-generic"
shortcut={ shortcut }
>
{ ! small && label }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ import { switchToBlockType } from '@wordpress/blocks';
import { withSelect, withDispatch } from '@wordpress/data';
import { compose } from '@wordpress/compose';

/**
* Internal dependencies
*/
import { Group, Ungroup } from './icons';

export function ConvertToGroupButton( {
onConvertToGroup,
onConvertFromGroup,
Expand All @@ -29,7 +24,6 @@ export function ConvertToGroupButton( {
{ isGroupable && (
<MenuItem
className="editor-block-settings-menu__control block-editor-block-settings-menu__control"
icon={ Group }
onClick={ onConvertToGroup }
>
{ _x( 'Group', 'verb' ) }
Expand All @@ -38,7 +32,6 @@ export function ConvertToGroupButton( {
{ isUngroupable && (
<MenuItem
className="editor-block-settings-menu__control block-editor-block-settings-menu__control"
icon={ Ungroup }
onClick={ onConvertFromGroup }
>
{ _x( 'Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor ' ) }
Expand Down
13 changes: 0 additions & 13 deletions packages/editor/src/components/convert-to-group-buttons/icons.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export function ReusableBlockConvertButton( {
{ ! isReusable && (
<MenuItem
className="editor-block-settings-menu__control block-editor-block-settings-menu__control"
icon="controls-repeat"
onClick={ onConvertToReusable }
>
{ __( 'Add to Reusable blocks' ) }
Expand All @@ -36,7 +35,6 @@ export function ReusableBlockConvertButton( {
{ isReusable && (
<MenuItem
className="editor-block-settings-menu__control block-editor-block-settings-menu__control"
icon="controls-repeat"
onClick={ onConvertToStatic }
>
{ __( 'Convert to Regular Block' ) }
Expand Down

0 comments on commit 2f5eab8

Please sign in to comment.