-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathindex.js
57 lines (53 loc) · 1.34 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { MenuGroup } from '@wordpress/components';
import {
ActionItem,
MoreMenuDropdown,
PinnedItems,
} from '@wordpress/interface';
import { useViewportMatch } from '@wordpress/compose';
/**
* Internal dependencies
*/
import ModeSwitcher from '../mode-switcher';
import PreferencesMenuItem from '../preferences-menu-item';
import ToolsMoreMenuGroup from '../tools-more-menu-group';
import WritingMenu from '../writing-menu';
const MoreMenu = ( { showIconLabels } ) => {
const isLargeViewport = useViewportMatch( 'large' );
return (
<MoreMenuDropdown
toggleProps={ {
showTooltip: ! showIconLabels,
...( showIconLabels && { variant: 'tertiary' } ),
} }
>
{ ( { onClose } ) => (
<>
{ showIconLabels && ! isLargeViewport && (
<PinnedItems.Slot
className={ showIconLabels && 'show-icon-labels' }
scope="core/edit-post"
/>
) }
<WritingMenu />
<ModeSwitcher />
<ActionItem.Slot
name="core/edit-post/plugin-more-menu"
label={ __( 'Plugins' ) }
as={ MenuGroup }
fillProps={ { onClick: onClose } }
/>
<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />
<MenuGroup>
<PreferencesMenuItem />
</MenuGroup>
</>
) }
</MoreMenuDropdown>
);
};
export default MoreMenu;