UNPKG

@wordpress/editor

Version:
8 lines (7 loc) 2.27 kB
{ "version": 3, "sources": ["../../../src/components/sidebar/header.js"], "sourcesContent": ["import { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Tabs } from '@wordpress/ui';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { sidebars } from './constants';\n\nexport default function SidebarHeader() {\n\tconst { postTypeLabel, isRevisionsMode } = useSelect( ( select ) => {\n\t\tconst { getPostTypeLabel } = select( editorStore );\n\t\tconst { isRevisionsMode: _isRevisionsMode } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t};\n\t}, [] );\n\n\tlet documentLabel;\n\tif ( isRevisionsMode ) {\n\t\tdocumentLabel = __( 'Revision' );\n\t} else if ( postTypeLabel ) {\n\t\tdocumentLabel = decodeEntities( postTypeLabel );\n\t} else {\n\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\tdocumentLabel = _x( 'Document', 'noun, panel' );\n\t}\n\n\treturn (\n\t\t<Tabs.List activateOnFocus={ false }>\n\t\t\t<Tabs.Tab value={ sidebars.document }>{ documentLabel }</Tabs.Tab>\n\t\t\t<Tabs.Tab value={ sidebars.block }>\n\t\t\t\t{ /* translators: Text label for the Block Settings Sidebar tab. */ }\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.List>\n\t);\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB,kBAA0B;AAC1B,2BAA+B;AAC/B,gBAAqB;AACrB,mBAAqC;AACrC,yBAAuB;AACvB,uBAAyB;AAyBvB;AAvBa,SAAR,gBAAiC;AACvC,QAAM,EAAE,eAAe,gBAAgB,QAAI,uBAAW,CAAE,WAAY;AACnE,UAAM,EAAE,iBAAiB,IAAI,OAAQ,aAAAA,KAAY;AACjD,UAAM,EAAE,iBAAiB,iBAAiB,QAAI;AAAA,MAC7C,OAAQ,aAAAA,KAAY;AAAA,IACrB;AACA,WAAO;AAAA,MACN,eAAe,iBAAiB;AAAA,MAChC,iBAAiB,iBAAiB;AAAA,IACnC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,MAAI;AACJ,MAAK,iBAAkB;AACtB,wBAAgB,gBAAI,UAAW;AAAA,EAChC,WAAY,eAAgB;AAC3B,wBAAgB,qCAAgB,aAAc;AAAA,EAC/C,OAAO;AAEN,wBAAgB,gBAAI,YAAY,aAAc;AAAA,EAC/C;AAEA,SACC,6CAAC,eAAK,MAAL,EAAU,iBAAkB,OAC5B;AAAA,gDAAC,eAAK,KAAL,EAAS,OAAQ,0BAAS,UAAa,yBAAe;AAAA,IACvD,4CAAC,eAAK,KAAL,EAAS,OAAQ,0BAAS,OAExB,8BAAI,OAAQ,GACf;AAAA,KACD;AAEF;", "names": ["editorStore"] }