Skip to content

Commit

Permalink
Apply min-width via CSS class
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Sep 10, 2021
1 parent 674e6f2 commit b4cbea8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/components/src/tools-panel/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ export const ToolsPanelItem = css`
max-width: 100%;
}
`;

export const DropdownMenu = css`
min-width: 200px;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const getAriaLabel = ( label, isSelected ) => {

const ToolsPanelHeader = ( props, forwardedRef ) => {
const {
dropdownMenuClassName,
hasMenuItems,
label: labelText,
menuItems,
Expand All @@ -51,7 +52,7 @@ const ToolsPanelHeader = ( props, forwardedRef ) => {
<DropdownMenu
icon={ moreVertical }
label={ labelText }
menuProps={ { style: { minWidth: '200px' } } }
menuProps={ { className: dropdownMenuClassName } }
>
{ ( { onClose } ) => (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ export function useToolsPanelHeader( props ) {
return cx( styles.ToolsPanelHeader, className );
}, [ className ] );

const dropdownMenuClassName = useMemo( () => {
return cx( styles.DropdownMenu );
}, [] );

const { menuItems, hasMenuItems } = useToolsPanelContext();

return {
...otherProps,
dropdownMenuClassName,
hasMenuItems,
menuItems,
className: classes,
Expand Down

0 comments on commit b4cbea8

Please sign in to comment.