diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-05-30 22:10:20 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-31 12:11:58 -0300 |
commit | 395d181328543f0cfa155dfc49b93fd116f20a47 (patch) | |
tree | 095f450fa226540a502aaace04343f9ed52daa92 /src/content | |
parent | 8a769ecd4fc73f81f0631d074fd8152c8c6e62b2 (diff) |
content, css: generatePageSidebar: initiallyHidden slot
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/dependencies/generatePageSidebar.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/content/dependencies/generatePageSidebar.js b/src/content/dependencies/generatePageSidebar.js index 3ec928db..d3b55580 100644 --- a/src/content/dependencies/generatePageSidebar.js +++ b/src/content/dependencies/generatePageSidebar.js @@ -36,6 +36,16 @@ export default { type: 'boolean', default: false, }, + + // Provide to include all the HTML for the sidebar in place as usual, + // but start it out totally invisible. This is mainly so client-side + // JavaScript can show the sidebar if it needs to (and has a target + // to slot its own content into). If there are no boxes and this + // option *isn't* provided, then the sidebar will just be blank. + initiallyHidden: { + type: 'boolean', + default: false, + }, }, generate(slots, {html}) { @@ -67,7 +77,11 @@ export default { attributes.add('class', 'all-boxes-collapsible'); } - if (html.isBlank(slots.boxes)) { + if (slots.initiallyHidden) { + attributes.add('class', 'initially-hidden'); + } + + if (html.isBlank(slots.boxes) && !slots.initiallyHidden) { return html.blank(); } else { return html.tag('div', attributes, slots.boxes); |