@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
8 lines (7 loc) • 1.43 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../../src/components/post-author/index.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCombobox from './combobox';\nimport PostAuthorSelect from './select';\nimport { AUTHORS_QUERY } from './constants';\n\nconst minimumUsersForCombobox = 25;\n\n/**\n * Renders the component for selecting the post author.\n *\n * @return {React.ReactNode} The rendered component.\n */\nfunction PostAuthor() {\n\tconst showCombobox = useSelect( ( select ) => {\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\n\t\treturn authors?.length >= minimumUsersForCombobox;\n\t}, [] );\n\n\tif ( showCombobox ) {\n\t\treturn <PostAuthorCombobox />;\n\t}\n\treturn <PostAuthorSelect />;\n}\n\nexport default PostAuthor;\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,uBAAmC;AAKnC,sBAA+B;AAC/B,oBAA6B;AAC7B,uBAA8B;AAiBrB;AAfT,IAAM,0BAA0B;AAOhC,SAAS,aAAa;AACrB,QAAM,mBAAe,uBAAW,CAAE,WAAY;AAC7C,UAAM,UAAU,OAAQ,iBAAAA,KAAU,EAAE,SAAU,8BAAc;AAE5D,WAAO,SAAS,UAAU;AAAA,EAC3B,GAAG,CAAC,CAAE;AAEN,MAAK,cAAe;AACnB,WAAO,4CAAC,gBAAAC,SAAA,EAAmB;AAAA,EAC5B;AACA,SAAO,4CAAC,cAAAC,SAAA,EAAiB;AAC1B;AAEA,IAAO,sBAAQ;",
"names": ["coreStore", "PostAuthorCombobox", "PostAuthorSelect"]
}