From 098e26ce61a8a8468e0e30b8c9552708fe97f45d Mon Sep 17 00:00:00 2001 From: Kevin Paxman <kpaxman@uwaterloo.ca> Date: Mon, 6 Mar 2023 18:46:27 -0500 Subject: [PATCH] ISTWCMS-5898: adjust header spacing and fix display quirks --- src/patterns/01-core/mixins/_headings.scss | 3 ++- src/patterns/03-layouts/block/_block.scss | 18 ++++++++++++++++++ src/patterns/04-components/view/_view.scss | 6 ++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/patterns/01-core/mixins/_headings.scss b/src/patterns/01-core/mixins/_headings.scss index babd9f99..32459d46 100644 --- a/src/patterns/01-core/mixins/_headings.scss +++ b/src/patterns/01-core/mixins/_headings.scss @@ -20,7 +20,8 @@ } // Add top margin when headers are preceded by other elements (p, ul, etc.) - * + & { + // (excluding the uw-admin-label that identifies the blocks in layout builder) + *:not(.uw-admin-label) + & { margin-top: var(--size-2); } diff --git a/src/patterns/03-layouts/block/_block.scss b/src/patterns/03-layouts/block/_block.scss index da90a1ae..8f530799 100644 --- a/src/patterns/03-layouts/block/_block.scss +++ b/src/patterns/03-layouts/block/_block.scss @@ -13,9 +13,27 @@ &.block-local-tasks-block { margin-bottom: 0; } + // Move block title to top of block, while preserving spacing underneath. + & > { + h2:first-child, + .uw-admin-label + h2 { + line-height: 1em; /* using EMs because we want it to be the height of the text, regardless of what the font size is */ + margin: 0 0 var(--size-2); + padding-top: 0; + } + } &:last-of-type { margin-bottom: 0; } + // Move an initial header in copy text to top of block, while preserving spacing underneath, unless there was a block title.. + .uw-admin-label + .contextual + .uw-copy-text, + .uw-copy-text:first-child { + .uw-copy-text__wrapper > :where(h2, h3, h4, h5, h6):first-child { + line-height: 1em; /* using EMs because we want it to be the height of the text, regardless of what the font size is */ + margin: 0 0 var(--size-2); + padding-top: 0; + } + } } // disable margin for layout builder blocks diff --git a/src/patterns/04-components/view/_view.scss b/src/patterns/04-components/view/_view.scss index 5a91a425..660e689f 100644 --- a/src/patterns/04-components/view/_view.scss +++ b/src/patterns/04-components/view/_view.scss @@ -403,3 +403,9 @@ $sidebar-width: 18.75rem; gap: var(--size-1); justify-content: flex-end; } + +// Make views display properly in layout builder (particularly narrow columns). +.layout-builder-block.views-element-container { + padding: 1.5em; /* The default for layout builder blocks; for some reason it only works if I set it explicitly */ + width: auto; +} -- GitLab