-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
index.js
57 lines (51 loc) · 1.32 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 { __, sprintf } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import Header from './header';
import Table from './table';
import Layout from '../layout';
import useRegisterShortcuts from './use-register-shortcuts';
function List() {
useRegisterShortcuts();
return <Table />;
}
List.renderLayout = function renderListLayout( {
postType,
activeTemplateType,
} ) {
// `postType` could load in asynchronously. Only provide the detailed region labels if
// the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.
const itemsListLabel = postType?.labels?.items_list;
const detailedRegionLabels = postType
? {
header: sprintf(
// translators: %s - the name of the page, 'Header' as in the header area of that page.
__( '%s - Header' ),
itemsListLabel
),
body: sprintf(
// translators: %s - the name of the page, 'Content' as in the content area of that page.
__( '%s - Content' ),
itemsListLabel
),
}
: undefined;
return (
<Layout
isNavigationDefaultOpen
activeTemplateType={ activeTemplateType }
className="edit-site-list"
labels={ {
drawer: __( 'Navigation Sidebar' ),
...detailedRegionLabels,
} }
header={ <Header /> }
content={ <List /> }
/>
);
};
export default List;