@wordpress/edit-site 3.0.11 → 3.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template-part.js +34 -17
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +41 -22
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +3 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +4 -4
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +71 -0
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +5 -5
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +11 -5
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +3 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +23 -3
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +3 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +3 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +54 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +74 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +28 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +12 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +2 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/list/actions/index.js +104 -0
- package/build/components/list/actions/index.js.map +1 -0
- package/build/components/list/actions/rename-menu-item.js +112 -0
- package/build/components/list/actions/rename-menu-item.js.map +1 -0
- package/build/components/list/added-by.js +180 -0
- package/build/components/list/added-by.js.map +1 -0
- package/build/components/list/index.js +18 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +58 -67
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -11
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +28 -11
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +14 -5
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/template-details/edit-template-title.js +33 -0
- package/build/components/template-details/edit-template-title.js.map +1 -0
- package/build/components/template-details/index.js +6 -2
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +1 -1
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/build/store/actions.js +47 -18
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +25 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +30 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +40 -23
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +5 -5
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +60 -0
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +5 -5
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +12 -5
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +3 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +22 -3
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +3 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +3 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +41 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +70 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +28 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +11 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/list/actions/index.js +85 -0
- package/build-module/components/list/actions/index.js.map +1 -0
- package/build-module/components/list/actions/rename-menu-item.js +101 -0
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -0
- package/build-module/components/list/added-by.js +166 -0
- package/build-module/components/list/added-by.js.map +1 -0
- package/build-module/components/list/index.js +15 -3
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +60 -69
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +11 -12
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +26 -12
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +14 -6
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/template-details/edit-template-title.js +23 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -0
- package/build-module/components/template-details/index.js +5 -2
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +1 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/index.js +8 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +48 -19
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +146 -21
- package/build-style/style.css +146 -21
- package/package.json +10 -8
- package/src/components/add-new-template/new-template-part.js +32 -17
- package/src/components/add-new-template/new-template.js +39 -19
- package/src/components/block-editor/index.js +2 -0
- package/src/components/global-styles/color-palette-panel.js +5 -5
- package/src/components/global-styles/gradients-palette-panel.js +99 -0
- package/src/components/global-styles/hooks.js +4 -4
- package/src/components/global-styles/palette.js +30 -10
- package/src/components/global-styles/screen-background-color.js +2 -0
- package/src/components/global-styles/screen-color-palette.js +30 -3
- package/src/components/global-styles/screen-link-color.js +2 -0
- package/src/components/global-styles/screen-text-color.js +2 -0
- package/src/components/global-styles/screen-typography-element.js +39 -0
- package/src/components/global-styles/screen-typography.js +84 -3
- package/src/components/global-styles/style.scss +45 -6
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/test/utils.js +1 -1
- package/src/components/global-styles/typography-panel.js +37 -7
- package/src/components/global-styles/ui.js +9 -0
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/list/actions/index.js +95 -0
- package/src/components/list/actions/rename-menu-item.js +134 -0
- package/src/components/list/added-by.js +179 -0
- package/src/components/list/index.js +27 -11
- package/src/components/list/style.scss +106 -11
- package/src/components/list/table.js +65 -75
- package/src/components/navigation-sidebar/index.js +9 -16
- package/src/components/navigation-sidebar/navigation-panel/index.js +25 -9
- package/src/components/navigation-sidebar/navigation-toggle/index.js +29 -17
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +2 -0
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/template-details/edit-template-title.js +28 -0
- package/src/components/template-details/index.js +13 -8
- package/src/components/template-details/template-areas.js +1 -1
- package/src/index.js +10 -2
- package/src/store/actions.js +82 -34
- package/src/store/selectors.js +22 -4
- package/src/store/test/actions.js +0 -24
- package/src/store/test/selectors.js +24 -0
|
@@ -3,39 +3,21 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useSelect
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
8
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
-
import { VisuallyHidden,
|
|
10
|
-
import { moreVertical } from '@wordpress/icons';
|
|
9
|
+
import { VisuallyHidden, __experimentalHeading as Heading } from '@wordpress/components';
|
|
11
10
|
import { addQueryArgs } from '@wordpress/url';
|
|
12
11
|
/**
|
|
13
12
|
* Internal dependencies
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
function Actions(_ref) {
|
|
20
|
-
let {
|
|
21
|
-
template,
|
|
22
|
-
onClose
|
|
23
|
-
} = _ref;
|
|
24
|
-
const {
|
|
25
|
-
removeTemplate
|
|
26
|
-
} = useDispatch(editSiteStore);
|
|
27
|
-
return createElement(MenuGroup, null, createElement(MenuItem, {
|
|
28
|
-
onClick: () => {
|
|
29
|
-
removeTemplate(template);
|
|
30
|
-
onClose();
|
|
31
|
-
}
|
|
32
|
-
}, __('Remove template')));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default function Table(_ref2) {
|
|
15
|
+
import Actions from './actions';
|
|
16
|
+
import AddedBy from './added-by';
|
|
17
|
+
export default function Table(_ref) {
|
|
36
18
|
let {
|
|
37
19
|
templateType
|
|
38
|
-
} =
|
|
20
|
+
} = _ref;
|
|
39
21
|
const {
|
|
40
22
|
templates,
|
|
41
23
|
isLoading,
|
|
@@ -47,8 +29,12 @@ export default function Table(_ref2) {
|
|
|
47
29
|
getPostType
|
|
48
30
|
} = select(coreStore);
|
|
49
31
|
return {
|
|
50
|
-
templates: getEntityRecords('postType', templateType
|
|
51
|
-
|
|
32
|
+
templates: getEntityRecords('postType', templateType, {
|
|
33
|
+
per_page: -1
|
|
34
|
+
}),
|
|
35
|
+
isLoading: !hasFinishedResolution('getEntityRecords', ['postType', templateType, {
|
|
36
|
+
per_page: -1
|
|
37
|
+
}]),
|
|
52
38
|
postType: getPostType(templateType)
|
|
53
39
|
};
|
|
54
40
|
}, [templateType]);
|
|
@@ -64,48 +50,53 @@ export default function Table(_ref2) {
|
|
|
64
50
|
__('No %s found.'), postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : (_postType$labels$name = _postType$labels.name) === null || _postType$labels$name === void 0 ? void 0 : _postType$labels$name.toLowerCase()));
|
|
65
51
|
}
|
|
66
52
|
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
53
|
+
return (// These explicit aria roles are needed for Safari.
|
|
54
|
+
// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables
|
|
55
|
+
createElement("table", {
|
|
56
|
+
className: "edit-site-list-table",
|
|
57
|
+
role: "table"
|
|
58
|
+
}, createElement("thead", null, createElement("tr", {
|
|
59
|
+
className: "edit-site-list-table-head",
|
|
60
|
+
role: "row"
|
|
61
|
+
}, createElement("th", {
|
|
62
|
+
className: "edit-site-list-table-column",
|
|
63
|
+
role: "columnheader"
|
|
64
|
+
}, __('Template')), createElement("th", {
|
|
65
|
+
className: "edit-site-list-table-column",
|
|
66
|
+
role: "columnheader"
|
|
67
|
+
}, __('Added by')), createElement("th", {
|
|
68
|
+
className: "edit-site-list-table-column",
|
|
69
|
+
role: "columnheader"
|
|
70
|
+
}, createElement(VisuallyHidden, null, __('Actions'))))), createElement("tbody", null, templates.map(template => {
|
|
71
|
+
var _template$title;
|
|
72
|
+
|
|
73
|
+
return createElement("tr", {
|
|
74
|
+
key: template.id,
|
|
75
|
+
className: "edit-site-list-table-row",
|
|
76
|
+
role: "row"
|
|
77
|
+
}, createElement("td", {
|
|
78
|
+
className: "edit-site-list-table-column",
|
|
79
|
+
role: "cell"
|
|
80
|
+
}, createElement(Heading, {
|
|
81
|
+
level: 4
|
|
82
|
+
}, createElement("a", {
|
|
83
|
+
href: addQueryArgs(window.location.href, {
|
|
84
|
+
postId: template.id,
|
|
85
|
+
postType: template.type
|
|
86
|
+
})
|
|
87
|
+
}, ((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug)), template.description), createElement("td", {
|
|
88
|
+
className: "edit-site-list-table-column",
|
|
89
|
+
role: "cell"
|
|
90
|
+
}, createElement(AddedBy, {
|
|
91
|
+
templateType: templateType,
|
|
92
|
+
template: template
|
|
93
|
+
})), createElement("td", {
|
|
94
|
+
className: "edit-site-list-table-column",
|
|
95
|
+
role: "cell"
|
|
96
|
+
}, createElement(Actions, {
|
|
97
|
+
template: template
|
|
98
|
+
})));
|
|
99
|
+
})))
|
|
100
|
+
);
|
|
110
101
|
}
|
|
111
102
|
//# sourceMappingURL=table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["useSelect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["useSelect","store","coreStore","__","sprintf","VisuallyHidden","__experimentalHeading","Heading","addQueryArgs","Actions","AddedBy","Table","templateType","templates","isLoading","postType","select","getEntityRecords","hasFinishedResolution","getPostType","per_page","length","labels","name","toLowerCase","map","template","id","window","location","href","postId","type","title","rendered","slug","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,cADD,EAECC,qBAAqB,IAAIC,OAF1B,QAGO,uBAHP;AAIA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,OAAP,MAAoB,YAApB;AAEA,eAAe,SAASC,KAAT,OAAmC;AAAA,MAAnB;AAAEC,IAAAA;AAAF,GAAmB;AACjD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwBC,IAAAA;AAAxB,MAAqCf,SAAS,CACjDgB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,gBADK;AAELC,MAAAA,qBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEd,SAAF,CAJV;AAMA,WAAO;AACNW,MAAAA,SAAS,EAAEI,gBAAgB,CAAE,UAAF,EAAcL,YAAd,EAA4B;AACtDQ,QAAAA,QAAQ,EAAE,CAAC;AAD2C,OAA5B,CADrB;AAINN,MAAAA,SAAS,EAAE,CAAEI,qBAAqB,CAAE,kBAAF,EAAsB,CACvD,UADuD,EAEvDN,YAFuD,EAGvD;AAAEQ,QAAAA,QAAQ,EAAE,CAAC;AAAb,OAHuD,CAAtB,CAJ5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,IAAI,EAAGnB,YAAY,CAAEoB,MAAM,CAACC,QAAP,CAAgBC,IAAlB,EAAwB;AAC1CC,UAAAA,MAAM,EAAEL,QAAQ,CAACC,EADyB;AAE1CZ,UAAAA,QAAQ,EAAEW,QAAQ,CAACM;AAFuB,SAAxB;AADpB,SAMG,oBAAAN,QAAQ,CAACO,KAAT,oEAAgBC,QAAhB,KACDR,QAAQ,CAACS,IAPX,CADD,CADD,EAYGT,QAAQ,CAACU,WAZZ,CALD,EAoBC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,cAAC,OAAD;AACC,QAAA,YAAY,EAAGxB,YADhB;AAEC,QAAA,QAAQ,EAAGc;AAFZ,QADD,CApBD,EA0BC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,cAAC,OAAD;AAAS,QAAA,QAAQ,EAAGA;AAApB,QADD,CA1BD,CADgB;AAAA,KAAf,CADH,CAxBD;AAHD;AA+DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport Actions from './actions';\nimport AddedBy from './added-by';\n\nexport default function Table( { templateType } ) {\n\tconst { templates, isLoading, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecords,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tgetPostType,\n\t\t\t} = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\ttemplates: getEntityRecords( 'postType', templateType, {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} ),\n\t\t\t\tisLoading: ! hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\t{ per_page: -1 },\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( templateType ),\n\t\t\t};\n\t\t},\n\t\t[ templateType ]\n\t);\n\n\tif ( ! templates || isLoading ) {\n\t\treturn null;\n\t}\n\n\tif ( ! templates.length ) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: The template type name, should be either \"templates\" or \"template parts\".\n\t\t\t\t\t__( 'No %s found.' ),\n\t\t\t\t\tpostType?.labels?.name?.toLowerCase()\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t// These explicit aria roles are needed for Safari.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables\n\t\t<table className=\"edit-site-list-table\" role=\"table\">\n\t\t\t<thead>\n\t\t\t\t<tr className=\"edit-site-list-table-head\" role=\"row\">\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Added by' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\n\t\t\t<tbody>\n\t\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t\t<tr\n\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\tclassName=\"edit-site-list-table-row\"\n\t\t\t\t\t\trole=\"row\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Heading level={ 4 }>\n\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\thref={ addQueryArgs( window.location.href, {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: template.type,\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ template.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\ttemplate.slug }\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t{ template.description }\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<AddedBy\n\t\t\t\t\t\t\t\ttemplateType={ templateType }\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Actions template={ template } />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t) ) }\n\t\t\t</tbody>\n\t\t</table>\n\t);\n}\n"]}
|
|
@@ -3,13 +3,15 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useEffect
|
|
6
|
+
import { useEffect } from '@wordpress/element';
|
|
7
7
|
import { createSlotFill } from '@wordpress/components';
|
|
8
8
|
import { useViewportMatch } from '@wordpress/compose';
|
|
9
|
+
import { useDispatch } from '@wordpress/data';
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
12
13
|
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
13
15
|
import NavigationPanel from './navigation-panel';
|
|
14
16
|
import NavigationToggle from './navigation-toggle';
|
|
15
17
|
export const {
|
|
@@ -22,25 +24,22 @@ export default function NavigationSidebar(_ref) {
|
|
|
22
24
|
activeTemplateType
|
|
23
25
|
} = _ref;
|
|
24
26
|
const isDesktopViewport = useViewportMatch('medium');
|
|
25
|
-
const
|
|
27
|
+
const {
|
|
28
|
+
setIsNavigationPanelOpened
|
|
29
|
+
} = useDispatch(editSiteStore);
|
|
26
30
|
useEffect(() => {
|
|
27
31
|
// When transitioning to desktop open the navigation if `isDefaultOpen` is true.
|
|
28
32
|
if (isDefaultOpen && isDesktopViewport) {
|
|
29
|
-
|
|
33
|
+
setIsNavigationPanelOpened(true);
|
|
30
34
|
} // When transitioning to mobile/tablet, close the navigation.
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
if (!isDesktopViewport) {
|
|
34
|
-
|
|
38
|
+
setIsNavigationPanelOpened(false);
|
|
35
39
|
}
|
|
36
|
-
}, [isDefaultOpen, isDesktopViewport]);
|
|
37
|
-
return createElement(Fragment, null, createElement(NavigationToggle, {
|
|
38
|
-
|
|
39
|
-
setIsOpen: setIsNavigationOpen
|
|
40
|
-
}), createElement(NavigationPanel, {
|
|
41
|
-
isOpen: isNavigationOpen,
|
|
42
|
-
setIsOpen: setIsNavigationOpen,
|
|
43
|
-
activeTemplateType: activeTemplateType
|
|
40
|
+
}, [isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened]);
|
|
41
|
+
return createElement(Fragment, null, createElement(NavigationToggle, null), createElement(NavigationPanel, {
|
|
42
|
+
activeItem: activeTemplateType
|
|
44
43
|
}), createElement(NavigationPanelPreviewSlot, null));
|
|
45
44
|
}
|
|
46
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/index.js"],"names":["useEffect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/index.js"],"names":["useEffect","createSlotFill","useViewportMatch","useDispatch","store","editSiteStore","NavigationPanel","NavigationToggle","Fill","NavigationPanelPreviewFill","Slot","NavigationPanelPreviewSlot","NavigationSidebar","isDefaultOpen","activeTemplateType","isDesktopViewport","setIsNavigationPanelOpened"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AAEA,OAAO,MAAM;AACZC,EAAAA,IAAI,EAAEC,0BADM;AAEZC,EAAAA,IAAI,EAAEC;AAFM,IAGTV,cAAc,CAAE,gCAAF,CAHX;AAKP,eAAe,SAASW,iBAAT,OAGX;AAAA,MAHuC;AAC1CC,IAAAA,aAAa,GAAG,KAD0B;AAE1CC,IAAAA;AAF0C,GAGvC;AACH,QAAMC,iBAAiB,GAAGb,gBAAgB,CAAE,QAAF,CAA1C;AACA,QAAM;AAAEc,IAAAA;AAAF,MAAiCb,WAAW,CAAEE,aAAF,CAAlD;AAEAL,EAAAA,SAAS,CAAE,MAAM;AAChB;AACA,QAAKa,aAAa,IAAIE,iBAAtB,EAA0C;AACzCC,MAAAA,0BAA0B,CAAE,IAAF,CAA1B;AACA,KAJe,CAMhB;;;AACA,QAAK,CAAED,iBAAP,EAA2B;AAC1BC,MAAAA,0BAA0B,CAAE,KAAF,CAA1B;AACA;AACD,GAVQ,EAUN,CAAEH,aAAF,EAAiBE,iBAAjB,EAAoCC,0BAApC,CAVM,CAAT;AAYA,SACC,8BACC,cAAC,gBAAD,OADD,EAEC,cAAC,eAAD;AAAiB,IAAA,UAAU,EAAGF;AAA9B,IAFD,EAGC,cAAC,0BAAD,OAHD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { createSlotFill } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport NavigationPanel from './navigation-panel';\nimport NavigationToggle from './navigation-toggle';\n\nexport const {\n\tFill: NavigationPanelPreviewFill,\n\tSlot: NavigationPanelPreviewSlot,\n} = createSlotFill( 'EditSiteNavigationPanelPreview' );\n\nexport default function NavigationSidebar( {\n\tisDefaultOpen = false,\n\tactiveTemplateType,\n} ) {\n\tconst isDesktopViewport = useViewportMatch( 'medium' );\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\t// When transitioning to desktop open the navigation if `isDefaultOpen` is true.\n\t\tif ( isDefaultOpen && isDesktopViewport ) {\n\t\t\tsetIsNavigationPanelOpened( true );\n\t\t}\n\n\t\t// When transitioning to mobile/tablet, close the navigation.\n\t\tif ( ! isDesktopViewport ) {\n\t\t\tsetIsNavigationPanelOpened( false );\n\t\t}\n\t}, [ isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened ] );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigationToggle />\n\t\t\t<NavigationPanel activeItem={ activeTemplateType } />\n\t\t\t<NavigationPanelPreviewSlot />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -10,51 +10,61 @@ import classnames from 'classnames';
|
|
|
10
10
|
|
|
11
11
|
import { __experimentalNavigation as Navigation, __experimentalNavigationBackButton as NavigationBackButton, __experimentalNavigationGroup as NavigationGroup, __experimentalNavigationItem as NavigationItem, __experimentalNavigationMenu as NavigationMenu } from '@wordpress/components';
|
|
12
12
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
13
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
14
|
import { useEffect, useRef } from '@wordpress/element';
|
|
15
15
|
import { __ } from '@wordpress/i18n';
|
|
16
16
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
17
17
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
18
18
|
import { addQueryArgs } from '@wordpress/url';
|
|
19
|
+
import { home as siteIcon, layout as templateIcon, symbolFilled as templatePartIcon } from '@wordpress/icons';
|
|
19
20
|
/**
|
|
20
21
|
* Internal dependencies
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
import MainDashboardButton from '../../main-dashboard-button';
|
|
25
|
+
import { store as editSiteStore } from '../../../store';
|
|
26
|
+
const SITE_EDITOR_KEY = 'site-editor';
|
|
24
27
|
|
|
25
28
|
const NavigationPanel = _ref => {
|
|
26
29
|
let {
|
|
27
|
-
|
|
28
|
-
setIsOpen,
|
|
29
|
-
activeTemplateType
|
|
30
|
+
activeItem = SITE_EDITOR_KEY
|
|
30
31
|
} = _ref;
|
|
31
|
-
const
|
|
32
|
+
const {
|
|
33
|
+
isNavigationOpen,
|
|
34
|
+
siteTitle
|
|
35
|
+
} = useSelect(select => {
|
|
32
36
|
const {
|
|
33
37
|
getEntityRecord
|
|
34
38
|
} = select(coreDataStore);
|
|
35
39
|
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
|
|
36
|
-
return
|
|
37
|
-
|
|
40
|
+
return {
|
|
41
|
+
siteTitle: siteData.name,
|
|
42
|
+
isNavigationOpen: select(editSiteStore).isNavigationOpened()
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
const {
|
|
46
|
+
setIsNavigationPanelOpened
|
|
47
|
+
} = useDispatch(editSiteStore); // Ensures focus is moved to the panel area when it is activated
|
|
38
48
|
// from a separate component (such as document actions in the header).
|
|
39
49
|
|
|
40
50
|
const panelRef = useRef();
|
|
41
51
|
useEffect(() => {
|
|
42
|
-
if (
|
|
52
|
+
if (isNavigationOpen) {
|
|
43
53
|
panelRef.current.focus();
|
|
44
54
|
}
|
|
45
|
-
}, [
|
|
55
|
+
}, [activeItem, isNavigationOpen]);
|
|
46
56
|
|
|
47
57
|
const closeOnEscape = event => {
|
|
48
58
|
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
49
59
|
event.preventDefault();
|
|
50
|
-
|
|
60
|
+
setIsNavigationPanelOpened(false);
|
|
51
61
|
}
|
|
52
62
|
};
|
|
53
63
|
|
|
54
64
|
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
55
65
|
createElement("div", {
|
|
56
66
|
className: classnames(`edit-site-navigation-panel`, {
|
|
57
|
-
'is-open':
|
|
67
|
+
'is-open': isNavigationOpen
|
|
58
68
|
}),
|
|
59
69
|
ref: panelRef,
|
|
60
70
|
tabIndex: "-1",
|
|
@@ -68,7 +78,7 @@ const NavigationPanel = _ref => {
|
|
|
68
78
|
}, decodeEntities(siteTitle))), createElement("div", {
|
|
69
79
|
className: "edit-site-navigation-panel__scroll-container"
|
|
70
80
|
}, createElement(Navigation, {
|
|
71
|
-
activeItem:
|
|
81
|
+
activeItem: activeItem
|
|
72
82
|
}, createElement(MainDashboardButton.Slot, null, createElement(NavigationBackButton, {
|
|
73
83
|
backButtonLabel: __('Dashboard'),
|
|
74
84
|
className: "edit-site-navigation-panel__back-to-dashboard",
|
|
@@ -76,12 +86,15 @@ const NavigationPanel = _ref => {
|
|
|
76
86
|
})), createElement(NavigationMenu, null, createElement(NavigationGroup, {
|
|
77
87
|
title: __('Editor')
|
|
78
88
|
}, createElement(NavigationItem, {
|
|
89
|
+
icon: siteIcon,
|
|
79
90
|
title: __('Site'),
|
|
91
|
+
item: SITE_EDITOR_KEY,
|
|
80
92
|
href: addQueryArgs(window.location.href, {
|
|
81
93
|
postId: undefined,
|
|
82
94
|
postType: undefined
|
|
83
95
|
})
|
|
84
96
|
}), createElement(NavigationItem, {
|
|
97
|
+
icon: templateIcon,
|
|
85
98
|
title: __('Templates'),
|
|
86
99
|
item: "wp_template",
|
|
87
100
|
href: addQueryArgs(window.location.href, {
|
|
@@ -89,6 +102,7 @@ const NavigationPanel = _ref => {
|
|
|
89
102
|
postType: 'wp_template'
|
|
90
103
|
})
|
|
91
104
|
}), createElement(NavigationItem, {
|
|
105
|
+
icon: templatePartIcon,
|
|
92
106
|
title: __('Template Parts'),
|
|
93
107
|
item: "wp_template_part",
|
|
94
108
|
href: addQueryArgs(window.location.href, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["classnames","__experimentalNavigation","Navigation","__experimentalNavigationBackButton","NavigationBackButton","__experimentalNavigationGroup","NavigationGroup","__experimentalNavigationItem","NavigationItem","__experimentalNavigationMenu","NavigationMenu","store","coreDataStore","useSelect","useEffect","useRef","__","ESCAPE","decodeEntities","addQueryArgs","MainDashboardButton","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["classnames","__experimentalNavigation","Navigation","__experimentalNavigationBackButton","NavigationBackButton","__experimentalNavigationGroup","NavigationGroup","__experimentalNavigationItem","NavigationItem","__experimentalNavigationMenu","NavigationMenu","store","coreDataStore","useSelect","useDispatch","useEffect","useRef","__","ESCAPE","decodeEntities","addQueryArgs","home","siteIcon","layout","templateIcon","symbolFilled","templatePartIcon","MainDashboardButton","editSiteStore","SITE_EDITOR_KEY","NavigationPanel","activeItem","isNavigationOpen","siteTitle","select","getEntityRecord","siteData","undefined","name","isNavigationOpened","setIsNavigationPanelOpened","panelRef","current","focus","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","window","location","href","postId","postType"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,4BAA4B,IAAIC,cAJjC,EAKCC,4BAA4B,IAAIC,cALjC,QAMO,uBANP;AAOA,SAASC,KAAK,IAAIC,aAAlB,QA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AEhB;AAFgC,OAAxB;AAJpB,MADD,EAUC,cAAC,cAAD;AACC,MAAA,IAAI,EAAGb,YADR;AAEC,MAAA,KAAK,EAAGP,EAAE,CAAE,WAAF,CAFX;AAGC,MAAA,IAAI,EAAC,aAHN;AAIC,MAAA,IAAI,EAAGG,YAAY,CAAE6B,MAAM,CAACC,QAAP,CAAgBC,IAAlB,EAAwB;AAC1CC,QAAAA,MAAM,EAAEf,SADkC;AAE1CgB,QAAAA,QAAQ,EAAE;AAFgC,OAAxB;AAJpB,MAVD,EAmBC,cAAC,cAAD;AACC,MAAA,IAAI,EAAG3B,gBADR;AAEC,MAAA,KAAK,EAAGT,EAAE,CAAE,gBAAF,CAFX;AAGC,MAAA,IAAI,EAAC,kBAHN;AAIC,MAAA,IAAI,EAAGG,YAAY,CAAE6B,MAAM,CAACC,QAAP,CAAgBC,IAAlB,EAAwB;AAC1CC,QAAAA,MAAM,EAAEf,SADkC;AAE1CgB,QAAAA,QAAQ,EAAE;AAFgC,OAAxB;AAJpB,MAnBD,CADD,CATD,CADD,CAND,CARD;AAFD;AA8DA,CA5FD;;AA8FA,eAAevB,eAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigation as Navigation,\n\t__experimentalNavigationBackButton as NavigationBackButton,\n\t__experimentalNavigationGroup as NavigationGroup,\n\t__experimentalNavigationItem as NavigationItem,\n\t__experimentalNavigationMenu as NavigationMenu,\n} from '@wordpress/components';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { addQueryArgs } from '@wordpress/url';\nimport {\n\thome as siteIcon,\n\tlayout as templateIcon,\n\tsymbolFilled as templatePartIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MainDashboardButton from '../../main-dashboard-button';\nimport { store as editSiteStore } from '../../../store';\n\nconst SITE_EDITOR_KEY = 'site-editor';\n\nconst NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {\n\tconst { isNavigationOpen, siteTitle } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tsiteTitle: siteData.name,\n\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\t// Ensures focus is moved to the panel area when it is activated\n\t// from a separate component (such as document actions in the header).\n\tconst panelRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isNavigationOpen ) {\n\t\t\tpanelRef.current.focus();\n\t\t}\n\t}, [ activeItem, isNavigationOpen ] );\n\n\tconst closeOnEscape = ( event ) => {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsNavigationPanelOpened( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames( `edit-site-navigation-panel`, {\n\t\t\t\t'is-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tref={ panelRef }\n\t\t\ttabIndex=\"-1\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-site-navigation-panel__inner\">\n\t\t\t\t<div className=\"edit-site-navigation-panel__site-title-container\">\n\t\t\t\t\t<div className=\"edit-site-navigation-panel__site-title\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-navigation-panel__scroll-container\">\n\t\t\t\t\t<Navigation activeItem={ activeItem }>\n\t\t\t\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\t\t\tbackButtonLabel={ __( 'Dashboard' ) }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-navigation-panel__back-to-dashboard\"\n\t\t\t\t\t\t\t\thref=\"index.php\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MainDashboardButton.Slot>\n\n\t\t\t\t\t\t<NavigationMenu>\n\t\t\t\t\t\t\t<NavigationGroup title={ __( 'Editor' ) }>\n\t\t\t\t\t\t\t\t<NavigationItem\n\t\t\t\t\t\t\t\t\ticon={ siteIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Site' ) }\n\t\t\t\t\t\t\t\t\titem={ SITE_EDITOR_KEY }\n\t\t\t\t\t\t\t\t\thref={ addQueryArgs( window.location.href, {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: undefined,\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<NavigationItem\n\t\t\t\t\t\t\t\t\ticon={ templateIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Templates' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template\"\n\t\t\t\t\t\t\t\t\thref={ addQueryArgs( window.location.href, {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<NavigationItem\n\t\t\t\t\t\t\t\t\ticon={ templatePartIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Template Parts' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template_part\"\n\t\t\t\t\t\t\t\t\thref={ addQueryArgs( window.location.href, {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</NavigationGroup>\n\t\t\t\t\t\t</NavigationMenu>\n\t\t\t\t\t</Navigation>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default NavigationPanel;\n"]}
|
|
@@ -3,20 +3,24 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { Button, Icon, __unstableMotion as motion } from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
9
|
import { wordpress } from '@wordpress/icons';
|
|
10
10
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
11
11
|
import { useReducedMotion } from '@wordpress/compose';
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { store as editSiteStore } from '../../../store';
|
|
12
17
|
|
|
13
18
|
function NavigationToggle(_ref) {
|
|
14
19
|
let {
|
|
15
|
-
icon
|
|
16
|
-
isOpen,
|
|
17
|
-
setIsOpen
|
|
20
|
+
icon
|
|
18
21
|
} = _ref;
|
|
19
22
|
const {
|
|
23
|
+
isNavigationOpen,
|
|
20
24
|
isRequestingSiteIcon,
|
|
21
25
|
siteIconUrl
|
|
22
26
|
} = useSelect(select => {
|
|
@@ -26,13 +30,17 @@ function NavigationToggle(_ref) {
|
|
|
26
30
|
} = select(coreDataStore);
|
|
27
31
|
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
|
|
28
32
|
return {
|
|
33
|
+
isNavigationOpen: select(editSiteStore).isNavigationOpened(),
|
|
29
34
|
isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
|
|
30
35
|
siteIconUrl: siteData.site_icon_url
|
|
31
36
|
};
|
|
32
37
|
}, []);
|
|
38
|
+
const {
|
|
39
|
+
setIsNavigationPanelOpened
|
|
40
|
+
} = useDispatch(editSiteStore);
|
|
33
41
|
const disableMotion = useReducedMotion();
|
|
34
42
|
|
|
35
|
-
const toggleNavigationPanel = () =>
|
|
43
|
+
const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen);
|
|
36
44
|
|
|
37
45
|
let buttonIcon = createElement(Icon, {
|
|
38
46
|
size: "36px",
|
|
@@ -66,7 +74,7 @@ function NavigationToggle(_ref) {
|
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
return createElement(motion.div, {
|
|
69
|
-
className: 'edit-site-navigation-toggle' + (
|
|
77
|
+
className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''),
|
|
70
78
|
whileHover: "expand"
|
|
71
79
|
}, createElement(Button, {
|
|
72
80
|
className: "edit-site-navigation-toggle__button has-icon",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-toggle/index.js"],"names":["useSelect","Button","Icon","__unstableMotion","motion","__","wordpress","store","coreDataStore","useReducedMotion","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-toggle/index.js"],"names":["useSelect","useDispatch","Button","Icon","__unstableMotion","motion","__","wordpress","store","coreDataStore","useReducedMotion","editSiteStore","NavigationToggle","icon","isNavigationOpen","isRequestingSiteIcon","siteIconUrl","select","getEntityRecord","isResolving","siteData","undefined","isNavigationOpened","site_icon_url","setIsNavigationPanelOpened","disableMotion","toggleNavigationPanel","buttonIcon","effect","expand","scale","borderRadius","transition","type","duration"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,gBAAgB,IAAIC,MAHrB,QAIO,uBAJP;AAKA,SAASC,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AK,EAAE,GADA;AAEPC,MAAAA,YAAY,EAAE,CAFP;AAGPC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,IAAI,EAAE,OAAR;AAAiBC,QAAAA,QAAQ,EAAE;AAA3B;AAHL;AADM,GAAf;;AAQA,MAAKlB,WAAL,EAAmB;AAClBW,IAAAA,UAAU,GACT,cAAC,MAAD,CAAQ,GAAR;AACC,MAAA,QAAQ,EAAG,CAAEF,aAAF,IAAmBG,MAD/B;AAEC,MAAA,GAAG,EAAGtB,EAAE,CAAE,WAAF,CAFT;AAGC,MAAA,SAAS,EAAC,wCAHX;AAIC,MAAA,GAAG,EAAGU;AAJP,MADD;AAQA,GATD,MASO,IAAKD,oBAAL,EAA4B;AAClCY,IAAAA,UAAU,GAAG,IAAb;AACA,GAFM,MAEA,IAAKd,IAAL,EAAY;AAClBc,IAAAA,UAAU,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,IAAI,EAAGd;AAAzB,MAAb;AACA;;AAED,SACC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EACR,iCACEC,gBAAgB,GAAG,UAAH,GAAgB,EADlC,CAFF;AAKC,IAAA,UAAU,EAAC;AALZ,KAOC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,KAAK,EAAGR,EAAE,CAAE,mBAAF,CAFX;AAGC,IAAA,OAAO,EAAGoB,qBAHX;AAIC,IAAA,WAAW;AAJZ,KAMGC,UANH,CAPD,CADD;AAkBA;;AAED,eAAef,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { wordpress } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nfunction NavigationToggle( { icon } ) {\n\tconst { isNavigationOpen, isRequestingSiteIcon, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\t\treturn {\n\t\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tconst toggleNavigationPanel = () =>\n\t\tsetIsNavigationPanelOpened( ! isNavigationOpen );\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.7,\n\t\t\tborderRadius: 0,\n\t\t\ttransition: { type: 'tween', duration: '0.2' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-site-navigation-toggle__site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t} else if ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t} else if ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={\n\t\t\t\t'edit-site-navigation-toggle' +\n\t\t\t\t( isNavigationOpen ? ' is-open' : '' )\n\t\t\t}\n\t\t\twhileHover=\"expand\"\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-navigation-toggle__button has-icon\"\n\t\t\t\tlabel={ __( 'Toggle navigation' ) }\n\t\t\t\tonClick={ toggleNavigationPanel }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default NavigationToggle;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { TextControl } from '@wordpress/components';
|
|
8
|
+
import { useEntityProp } from '@wordpress/core-data';
|
|
9
|
+
export default function EditTemplateTitle(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
template
|
|
12
|
+
} = _ref;
|
|
13
|
+
const [title, setTitle] = useEntityProp('postType', template.type, 'title', template.id);
|
|
14
|
+
return createElement(TextControl, {
|
|
15
|
+
label: __('Title'),
|
|
16
|
+
value: title,
|
|
17
|
+
help: __('Give the template a title that indicates its purpose, e.g. "Full Width".'),
|
|
18
|
+
onChange: newTitle => {
|
|
19
|
+
setTitle(newTitle || template.slug);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=edit-template-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/edit-template-title.js"],"names":["__","TextControl","useEntityProp","EditTemplateTitle","template","title","setTitle","type","id","newTitle","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA,eAAe,SAASC,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBJ,aAAa,CACxC,UADwC,EAExCE,QAAQ,CAACG,IAF+B,EAGxC,OAHwC,EAIxCH,QAAQ,CAACI,EAJ+B,CAAzC;AAOA,SACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGR,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,KAAK,EAAGK,KAFT;AAGC,IAAA,IAAI,EAAGL,EAAE,CACR,0EADQ,CAHV;AAMC,IAAA,QAAQ,EAAKS,QAAF,IAAgB;AAC1BH,MAAAA,QAAQ,CAAEG,QAAQ,IAAIL,QAAQ,CAACM,IAAvB,CAAR;AACA;AARF,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\n\nexport default function EditTemplateTitle( { template } ) {\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\ttemplate.type,\n\t\t'title',\n\t\ttemplate.id\n\t);\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ title }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tsetTitle( newTitle || template.slug );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -17,6 +17,7 @@ import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
|
17
17
|
import { MENU_TEMPLATES, TEMPLATE_PARTS_SUB_MENUS } from '../navigation-sidebar/navigation-panel/constants';
|
|
18
18
|
import { store as editSiteStore } from '../../store';
|
|
19
19
|
import TemplateAreas from './template-areas';
|
|
20
|
+
import EditTemplateTitle from './edit-template-title';
|
|
20
21
|
export default function TemplateDetails(_ref) {
|
|
21
22
|
let {
|
|
22
23
|
template,
|
|
@@ -58,7 +59,9 @@ export default function TemplateDetails(_ref) {
|
|
|
58
59
|
className: "edit-site-template-details"
|
|
59
60
|
}, createElement("div", {
|
|
60
61
|
className: "edit-site-template-details__group"
|
|
61
|
-
}, createElement(
|
|
62
|
+
}, template.is_custom ? createElement(EditTemplateTitle, {
|
|
63
|
+
template: template
|
|
64
|
+
}) : createElement(Heading, {
|
|
62
65
|
level: 4,
|
|
63
66
|
weight: 600,
|
|
64
67
|
className: "edit-site-template-details__title"
|
|
@@ -72,7 +75,7 @@ export default function TemplateDetails(_ref) {
|
|
|
72
75
|
className: "edit-site-template-details__group edit-site-template-details__revert"
|
|
73
76
|
}, createElement(MenuItem, {
|
|
74
77
|
className: "edit-site-template-details__revert-button",
|
|
75
|
-
info: __('Restore template to
|
|
78
|
+
info: __('Restore template to default state'),
|
|
76
79
|
onClick: revert
|
|
77
80
|
}, __('Clear customizations'))), createElement(Button, {
|
|
78
81
|
className: "edit-site-template-details__show-all-button",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["useMemo","sprintf","__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","addQueryArgs","isTemplateRevertable","MENU_TEMPLATES","TEMPLATE_PARTS_SUB_MENUS","editSiteStore","TemplateAreas","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","templateSubMenu","type","menu","find","area","revert","window","location","href","postId","undefined","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,qBAAqB,IAAIC,OAJ1B,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SACCC,cADD,EAECC,wBAFD,QAGO,kDAHP;AAIA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,eAAe,SAASC,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["useMemo","sprintf","__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","addQueryArgs","isTemplateRevertable","MENU_TEMPLATES","TEMPLATE_PARTS_SUB_MENUS","editSiteStore","TemplateAreas","EditTemplateTitle","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","templateSubMenu","type","menu","find","area","revert","is_custom","window","location","href","postId","undefined","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,qBAAqB,IAAIC,OAJ1B,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SACCC,cADD,EAECC,wBAFD,QAGO,kDAHP;AAIA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AAEA,eAAe,SAASC,eAAT,OA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,CAJF,EAaGC,WAAW,IACZ,cAAC,IAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC,yCAFX;AAGC,IAAA,EAAE,EAAC;AAHJ,KAKGA,WALH,CAdF,CADD,EAyBC,cAAC,aAAD;AAAe,IAAA,4BAA4B,EAAGF;AAA9C,IAzBD,EA2BGR,oBAAoB,CAAEO,QAAF,CAApB,IACD,cAAC,SAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGpB,EAAE,CAAE,mCAAF,CAFV;AAGC,IAAA,OAAO,EAAGgC;AAHX,KAKGhC,EAAE,CAAE,sBAAF,CALL,CADD,CA5BF,EAuCC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAGY,YAAY,CAAEsB,MAAM,CAACC,QAAP,CAAgBC,IAAlB,EAAwB;AAC1C;AACAC,MAAAA,MAAM,EAAEC,SAFkC;AAG1CC,MAAAA,QAAQ,EAAEnB,QAAQ,CAACQ;AAHuB,KAAxB;AAFpB,KAQG7B,OAAO;AACR;AACAC,EAAAA,EAAE,CAAE,eAAF,CAFM,EAGR2B,eAAe,CAACL,KAHR,CARV,CAvCD,CADD;AAwDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport {\n\tMENU_TEMPLATES,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../navigation-sidebar/navigation-panel/constants';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst templateSubMenu = useMemo( () => {\n\t\tif ( template?.type === 'wp_template' ) {\n\t\t\treturn { title: __( 'templates' ), menu: MENU_TEMPLATES };\n\t\t}\n\n\t\treturn TEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t( { area } ) => area === template?.area\n\t\t);\n\t}, [ template ] );\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t{ template.is_custom ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Heading>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\thref={ addQueryArgs( window.location.href, {\n\t\t\t\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\t\t\t\tpostId: undefined,\n\t\t\t\t\tpostType: template.type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: the template part's area name (\"Headers\", \"Sidebars\") or \"templates\". */\n\t\t\t\t\t__( 'Browse all %s' ),\n\t\t\t\t\ttemplateSubMenu.title\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|