Skip to content

Commit

Permalink
Polish Command Palette (WordPress#60134)
Browse files Browse the repository at this point in the history
* Try resizing

* Move icon to right, try more descriptive placeholder

* remove duplicative spacing between groups

* Use value instead of $text-editor-font-size

Co-authored-by: richtabor <richtabor@git.wordpress.org>
Co-authored-by: SaxonF <saxonafletcher@git.wordpress.org>
  • Loading branch information
3 people authored and carstingaxion committed Mar 27, 2024
1 parent e9baa27 commit cc1f5a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/commands/src/components/command-menu.js
Expand Up @@ -32,7 +32,7 @@ import { Icon, search as inputIcon } from '@wordpress/icons';
*/
import { store as commandsStore } from '../store';

const inputLabel = __( 'Search for commands' );
const inputLabel = __( 'Search commands and settings' );

function CommandMenuLoader( { name, search, hook, setLoader, close } ) {
const { isLoading, commands = [] } = hook( { search } ) ?? {};
Expand Down Expand Up @@ -278,12 +278,12 @@ export function CommandMenu() {
<div className="commands-command-menu__container">
<Command label={ inputLabel } onKeyDown={ onKeyDown }>
<div className="commands-command-menu__header">
<Icon icon={ inputIcon } />
<CommandInput
search={ search }
setSearch={ setSearch }
isOpen={ isOpen }
/>
<Icon icon={ inputIcon } />
</div>
<Command.List ref={ commandListRef }>
{ search && ! isLoading && (
Expand Down
23 changes: 14 additions & 9 deletions packages/commands/src/components/style.scss
Expand Up @@ -3,12 +3,12 @@
border-radius: $grid-unit-05;
width: calc(100% - #{$grid-unit-40});
margin: auto;
max-width: 420px;
max-width: 400px;
position: relative;
top: calc(15% + #{$header-height});
top: calc(5% + #{$header-height});

@include break-small() {
top: 15%;
top: calc(10% + #{$header-height});
}

.components-modal__content {
Expand All @@ -25,7 +25,7 @@
.commands-command-menu__header {
display: flex;
align-items: center;
padding-left: $grid-unit-20;
padding: 0 $grid-unit-20;

.components-button {
height: $grid-unit-70;
Expand All @@ -49,11 +49,11 @@
[cmdk-input] {
border: none;
width: 100%;
padding: $grid-unit-20 $grid-unit-20 $grid-unit-20 $grid-unit-10;
padding: $grid-unit-20 $grid-unit-05;
outline: none;
color: $gray-900;
margin: 0;
font-size: 16px;
font-size: 15px;
line-height: 28px;
border-radius: 0;

Expand All @@ -74,7 +74,6 @@
align-items: center;
color: $gray-900;
font-size: $default-font-size;
min-height: $button-size-next-default-40px;

&[aria-selected="true"],
&:active {
Expand All @@ -96,7 +95,8 @@
}

> div {
padding: $grid-unit;
min-height: $button-size-next-default-40px;
padding: $grid-unit-05;
padding-left: $grid-unit-50; // Account for commands without icons.
}

Expand All @@ -109,8 +109,13 @@
max-height: 368px; // Specific to not have commands overflow oddly.
overflow: auto;

// Ensures there is always padding bottom on the last group, when there are commands.
& [cmdk-list-sizer] > [cmdk-group]:last-child [cmdk-group-items]:not(:empty) {
padding-bottom: $grid-unit-10;
}

& [cmdk-list-sizer] > [cmdk-group] > [cmdk-group-items]:not(:empty) {
padding: 0 $grid-unit $grid-unit;
padding: 0 $grid-unit-10;
}
}

Expand Down

0 comments on commit cc1f5a9

Please sign in to comment.