diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-30 19:59:09 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-31 12:11:46 -0300 |
commit | d14bf4dea47af3948b9f5d6a823699ac3c09a0bf (patch) | |
tree | a846b9f5649f4f4cd486e6964c6af93f5982d126 /src/content | |
parent | a8005955e72998fffc50f5d1fc7ae55d42a4b945 (diff) |
content: generateSearchSidebarBox (input appearance stub)
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/dependencies/generatePageLayout.js | 17 | ||||
-rw-r--r-- | src/content/dependencies/generateSearchSidebarBox.js | 21 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js index 5d2a48cb..54a75771 100644 --- a/src/content/dependencies/generatePageLayout.js +++ b/src/content/dependencies/generatePageLayout.js @@ -5,6 +5,7 @@ export default { contentDependencies: [ 'generateColorStyleRules', 'generateFooterLocalizationLinks', + 'generateSearchSidebarBox', 'generateStickyHeadingContainer', 'transformContent', ], @@ -42,6 +43,9 @@ export default { relations.stickyHeadingContainer = relation('generateStickyHeadingContainer'); + relations.searchBox = + relation('generateSearchSidebarBox'); + if (sprawl.footerContent) { relations.defaultFooterContent = relation('transformContent', sprawl.footerContent); @@ -64,6 +68,11 @@ export default { default: true, }, + showSearch: { + type: 'boolean', + default: true, + }, + additionalNames: { type: 'html', mutable: false, @@ -385,6 +394,14 @@ export default { const leftSidebar = getSidebar('leftSidebar', 'sidebar-left'); const rightSidebar = getSidebar('rightSidebar', 'sidebar-right'); + if (slots.showSearch && !html.isBlank(leftSidebar)) { + leftSidebar.setSlot('boxes', + html.tags([ + relations.searchBox, + leftSidebar.getSlotValue('boxes'), + ])); + } + const hasSidebarLeft = !html.isBlank(html.resolve(leftSidebar)); const hasSidebarRight = !html.isBlank(html.resolve(rightSidebar)); diff --git a/src/content/dependencies/generateSearchSidebarBox.js b/src/content/dependencies/generateSearchSidebarBox.js new file mode 100644 index 00000000..f2fddfa5 --- /dev/null +++ b/src/content/dependencies/generateSearchSidebarBox.js @@ -0,0 +1,21 @@ +export default { + contentDependencies: ['generatePageSidebarBox'], + extraDependencies: ['html'], + + relations: (relation) => ({ + sidebarBox: + relation('generatePageSidebarBox'), + }), + + generate: (relations, {html}) => + relations.sidebarBox.slots({ + attributes: {class: 'search-sidebar-box'}, + collapsible: false, + + content: [ + html.tag('input', {class: 'wiki-search-input'}, + {placeholder: `Search for anything`}, + {type: 'search'}) + ], + }), +}; |