Skip to content

Commit

Permalink
Fix label/input styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Oct 23, 2019
1 parent 651e76e commit 30feecb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 44 deletions.
19 changes: 8 additions & 11 deletions packages/block-library/src/navigation-menu-item/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
BlockControls,
InnerBlocks,
InspectorControls,
PlainText,
URLPopover,
} from '@wordpress/block-editor';
import {
Expand Down Expand Up @@ -84,16 +83,14 @@ function NavigationMenuItemEdit( {
let content;
if ( isSelected ) {
content = (
<div className="wp-block-navigation-menu-item__edit-container">
<PlainText
ref={ plainTextRef }
className="wp-block-navigation-menu-item__field"
value={ label }
onChange={ ( labelValue ) => setAttributes( { label: labelValue } ) }
aria-label={ __( 'Navigation Label' ) }
maxRows={ 1 }
/>
</div>
<TextControl
ref={ plainTextRef }
className="wp-block-navigation-menu-item__field"
value={ label }
onChange={ ( labelValue ) => setAttributes( { label: labelValue } ) }
label={ __( 'Navigation Label' ) }
hideLabelFromVision={ true }
/>
);
} else {
content = <div className="wp-block-navigation-menu-item__container">
Expand Down
38 changes: 5 additions & 33 deletions packages/block-library/src/navigation-menu-item/editor.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,15 @@
$menu-label-field-width: 140px;

.wp-block-navigation-menu-item__edit-container {
display: grid;
grid-auto-columns: min-content;
grid-auto-flow: column;
align-items: center;
white-space: nowrap;
border: 1px solid $light-gray-500;
// two pixes comes from two times one pixel border
width: $menu-label-field-width + $icon-button-size + 2px;
padding-left: 1px;
}

.wp-block-navigation-menu-item__edit-container .wp-block-navigation-menu-item__field {
border-right: 1px solid $light-gray-500 !important;
width: $menu-label-field-width;
border: none;
// Specificity override for .edit-post-visual-editor input[type="text"]
.wp-block-navigation-menu-item__field .components-text-control__input.components-text-control__input {
border-radius: 0;
padding-left: $grid-size-large;

min-height: $icon-button-size - 1px;
line-height: $icon-button-size - 1px;

&,
&:focus {
color: $dark-gray-500;
}
background-color: transparent;
padding: $block-padding;
}

.wp-block-navigation-menu-item__field .components-text-control__input.components-text-control__input,
.wp-block-navigation-menu-item {
font-family: $editor-font;
font-weight: bold;
font-size: $text-editor-font-size;

.wp-block-navigation-menu-item__container,
&.is-editing .editor-plain-text {
background-color: var(--background-color-menu-link);
color: var(--color-menu-link);
}
}

.wp-block-navigation-menu-item__nofollow-external-link {
Expand Down

0 comments on commit 30feecb

Please sign in to comment.