From 9aca91f5d0999ac513ebcdf7a5c74ecd952c7864 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 3 Apr 2024 18:11:12 -0300 Subject: content: generateListingPage: base on generatePageSidebar --- src/content/dependencies/generateListingPage.js | 2 +- src/content/dependencies/generateListingSidebar.js | 34 +++++++++++++--------- .../dependencies/generateListingsIndexPage.js | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/content/dependencies/generateListingPage.js b/src/content/dependencies/generateListingPage.js index aa661abd..23377afb 100644 --- a/src/content/dependencies/generateListingPage.js +++ b/src/content/dependencies/generateListingPage.js @@ -276,7 +276,7 @@ export default { {auto: 'current'}, ], - ...relations.sidebar, + leftSidebar: relations.sidebar, }); }, }; diff --git a/src/content/dependencies/generateListingSidebar.js b/src/content/dependencies/generateListingSidebar.js index 1cdd236b..1e5c8bfc 100644 --- a/src/content/dependencies/generateListingSidebar.js +++ b/src/content/dependencies/generateListingSidebar.js @@ -1,21 +1,29 @@ export default { - contentDependencies: ['generateListingIndexList', 'linkListingIndex'], + contentDependencies: [ + 'generateListingIndexList', + 'generatePageSidebar', + 'linkListingIndex', + ], + extraDependencies: ['html'], - relations(relation, currentListing) { - return { - listingIndexLink: relation('linkListingIndex'), - listingIndexList: relation('generateListingIndexList', currentListing), - }; - }, + relations: (relation, currentListing) => ({ + sidebar: + relation('generatePageSidebar'), + + listingIndexLink: + relation('linkListingIndex'), + + listingIndexList: + relation('generateListingIndexList', currentListing), + }), - generate(relations, {html}) { - return { - leftSidebarClass: 'listing-map-sidebar-box', - leftSidebarContent: [ + generate: (relations, {html}) => + relations.sidebar.slots({ + attributes: {class: 'listing-map-sidebar-box'}, + content: [ html.tag('h1', relations.listingIndexLink), relations.listingIndexList.slot('mode', 'sidebar'), ], - }; - }, + }), }; diff --git a/src/content/dependencies/generateListingsIndexPage.js b/src/content/dependencies/generateListingsIndexPage.js index 1b1c8559..b57ebe15 100644 --- a/src/content/dependencies/generateListingsIndexPage.js +++ b/src/content/dependencies/generateListingsIndexPage.js @@ -83,7 +83,7 @@ export default { {auto: 'current'}, ], - ...relations.sidebar, + leftSidebar: relations.sidebar, }); }, }; -- cgit 1.3.0-6-gf8a5