Skip to content

Commit 8e711f9

Browse files
committed
Set the toolbar dropdown menu variant in the toolbar component via the context system
1 parent b1a871d commit 8e711f9

File tree

1 file changed

+20
-7
lines changed
  • packages/components/src/toolbar/toolbar

1 file changed

+20
-7
lines changed

packages/components/src/toolbar/toolbar/index.tsx

+20-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@ import deprecated from '@wordpress/deprecated';
1616
import ToolbarGroup from '../toolbar-group';
1717
import ToolbarContainer from './toolbar-container';
1818
import type { ToolbarProps } from './types';
19-
import type { WordPressComponentProps } from '../../ui/context';
19+
import {
20+
WordPressComponentProps,
21+
ContextSystemProvider,
22+
} from '../../ui/context';
23+
24+
const CONTEXT_SYSTEM_VALUE = {
25+
DropdownMenu: {
26+
// Note: the legacy `DropdownMenu` component is not yet reactive to this
27+
// context variant. See https://github.com/WordPress/gutenberg/pull/51097.
28+
variant: 'toolbar',
29+
},
30+
};
2031

2132
function UnforwardedToolbar(
2233
{
@@ -40,12 +51,14 @@ function UnforwardedToolbar(
4051
className
4152
);
4253
return (
43-
<ToolbarContainer
44-
className={ finalClassName }
45-
label={ label }
46-
ref={ ref }
47-
{ ...props }
48-
/>
54+
<ContextSystemProvider value={ CONTEXT_SYSTEM_VALUE }>
55+
<ToolbarContainer
56+
className={ finalClassName }
57+
label={ label }
58+
ref={ ref }
59+
{ ...props }
60+
/>
61+
</ContextSystemProvider>
4962
);
5063
}
5164

0 commit comments

Comments
 (0)