UNPKG

@wordpress/editor

Version:
31 lines (25 loc) 851 B
import { createElement } from "@wordpress/element"; /** * WordPress dependencies */ import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies */ import PostAuthorCombobox from './combobox'; import PostAuthorSelect from './select'; const minimumUsersForCombobox = 25; function PostAuthor() { const showCombobox = useSelect(select => { // Not using `getUsers()` because it requires `list_users` capability. const authors = select(coreStore).getAuthors(); return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox; }, []); if (showCombobox) { return createElement(PostAuthorCombobox, null); } return createElement(PostAuthorSelect, null); } export default PostAuthor; //# sourceMappingURL=index.js.map