Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Date Block: Add dropdown menu props to ToolsPanel component
  • Loading branch information
Sukhendu2002 committed Dec 16, 2024
commit 2301eb0bd9a7b64cf0190303cdd288e5ea73b753
7 changes: 7 additions & 0 deletions packages/block-library/src/post-date/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ import { edit } from '@wordpress/icons';
import { DOWN } from '@wordpress/keycodes';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';

export default function PostDateEdit( {
attributes: { textAlign, format, isLink, displayType },
context: { postId, postType: postTypeSlug, queryId },
Expand All @@ -45,6 +50,7 @@ export default function PostDateEdit( {
[ `wp-block-post-date__modified-date` ]: displayType === 'modified',
} ),
} );
const dropdownMenuProps = useToolsPanelDropdownMenuProps();

// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
Expand Down Expand Up @@ -170,6 +176,7 @@ export default function PostDateEdit( {
displayType: 'date',
} );
} }
dropdownMenuProps={ dropdownMenuProps }
>
<ToolsPanelItem
hasValue={ () =>
Expand Down
Loading