From c23552b3d76af9cd43027af831566bd3e706b1f7 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:04:45 +0200 Subject: [PATCH] fix: remove extra top margin in the toc when there is no message block (#233) Only apply an extra top margin when the HTML generation that a message block is used. Closes #123 --- src/helpers/isMessageBlockDisplayed.js | 8 ++++++++ src/partials/toc.hbs | 2 +- src/partials/toolbar.hbs | 2 ++ src/stylesheets/globals/vars.scss | 4 +++- src/stylesheets/toc.scss | 9 +++++++++ 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/helpers/isMessageBlockDisplayed.js diff --git a/src/helpers/isMessageBlockDisplayed.js b/src/helpers/isMessageBlockDisplayed.js new file mode 100644 index 00000000..a4de1f9c --- /dev/null +++ b/src/helpers/isMessageBlockDisplayed.js @@ -0,0 +1,8 @@ +'use strict' + +module.exports = (page) => { + // To keep in sync with the message blocks that are supported (see partials/toolbar.hbs) + return page.attributes?.['next-release'] || + page.attributes?.['custom-message'] || + page.attributes?.['out-of-support'] +} diff --git a/src/partials/toc.hbs b/src/partials/toc.hbs index 2b291908..1825a1bb 100644 --- a/src/partials/toc.hbs +++ b/src/partials/toc.hbs @@ -1,3 +1,3 @@ -