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

DropdownMenu v2 style tweaks #50967

Merged
merged 3 commits into from
May 26, 2023
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
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Experimental

- `DropdownMenu` v2: Tweak styles ([#50967](https://github.com/WordPress/gutenberg/pull/50967)).

## 25.0.0 (2023-05-24)

### Breaking Changes
Expand Down
26 changes: 12 additions & 14 deletions packages/components/src/dropdown-menu-v2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const ANIMATION_PARAMS = {
EASING: 'cubic-bezier( 0.16, 1, 0.3, 1 )',
};

const CONTENT_WRAPPER_PADDING = space( 2 );
const ITEM_PREFIX_WIDTH = space( 7 );
const ITEM_PADDING_INLINE_START = space( 2 );
const ITEM_PADDING_INLINE_END = space( 2.5 );
Expand Down Expand Up @@ -58,7 +59,7 @@ const baseContent = css`
min-width: 220px;
background-color: ${ COLORS.ui.background };
border-radius: 6px;
padding: ${ space( 2 ) };
padding: ${ CONTENT_WRAPPER_PADDING };
box-shadow: 0.1px 4px 16.4px -0.5px rgba( 0, 0, 0, 0.1 ),
0px 5.5px 7.8px -0.3px rgba( 0, 0, 0, 0.1 ),
0px 2.7px 3.8px -0.2px rgba( 0, 0, 0, 0.1 ),
Expand Down Expand Up @@ -174,14 +175,13 @@ const baseItem = css`
pointer-events: none;
}

/* Hover and Focus styles */
&[data-highlighted] {
/*
TODO: reconcile with global focus styles
(incl high contrast mode fallbacks)
*/
/* TODO: reconcile with global focus styles */
background-color: ${ COLORS.gray[ '100' ] };

background-color: ${ COLORS.ui.theme };
color: white;
/* Only visible in Windows High Contrast mode */
outline: 2px solid transparent;
}

svg {
Expand Down Expand Up @@ -210,13 +210,11 @@ export const RadioItem = styled( DropdownMenu.RadioItem )`
${ baseItem }
`;
export const SubTrigger = styled( DropdownMenu.SubTrigger )`
&[data-state='open']:not( [data-highlighted] ) {
/* TODO: use variable */
background-color: rgba( 56, 88, 233, 0.04 );
color: ${ COLORS.ui.theme };
}

${ baseItem }

&[data-state='open'] {
background-color: ${ COLORS.gray[ '100' ] };
}
`;

export const Label = styled( DropdownMenu.Label )`
Expand All @@ -242,7 +240,7 @@ export const Separator = styled( DropdownMenu.Separator )`
/* TODO: doesn't match border color from variables */
background-color: ${ COLORS.ui.borderDisabled };
/* Negative horizontal margin to make separator go from side to side */
margin: ${ space( 2 ) } 0;
margin: ${ space( 2 ) } calc( -1 * ${ CONTENT_WRAPPER_PADDING } );
`;

export const ItemIndicator = styled( DropdownMenu.ItemIndicator )`
Expand Down