From 62b4f87bcfabc7a39f70731cde92d4aa95b576ae Mon Sep 17 00:00:00 2001 From: Lucas Cumsille M Date: Wed, 3 Jun 2026 05:15:49 +0000 Subject: [PATCH 1/9] Make `person-navigation` a reusable component - Moved styles from the `_mp.scss` page to `_in-page-nav.scss` - Fix wrong hierarchy markup in where the main title of the navigation was an `h3` element and then children were `h2`. --- www/docs/style/sass/app.scss | 2 +- www/docs/style/sass/pages/_mp.scss | 164 --------------- www/docs/style/sass/parts/_in-page-nav.scss | 189 ++++++++++++++++++ .../style/sass/parts/_table-of-contents.scss | 33 --- .../templates/html/mp/_person_navigation.php | 44 ++-- 5 files changed, 212 insertions(+), 220 deletions(-) create mode 100644 www/docs/style/sass/parts/_in-page-nav.scss delete mode 100644 www/docs/style/sass/parts/_table-of-contents.scss diff --git a/www/docs/style/sass/app.scss b/www/docs/style/sass/app.scss index 6a49949153..b567059ec3 100644 --- a/www/docs/style/sass/app.scss +++ b/www/docs/style/sass/app.scss @@ -309,7 +309,7 @@ form { @import "parts/sidebar_right"; @import "parts/dataframe"; @import "parts/accordion"; -@import "parts/table-of-contents"; +@import "parts/in-page-nav"; @import "parts/glossary"; @import "print"; diff --git a/www/docs/style/sass/pages/_mp.scss b/www/docs/style/sass/pages/_mp.scss index 43a0382d46..cdf0e06cae 100644 --- a/www/docs/style/sass/pages/_mp.scss +++ b/www/docs/style/sass/pages/_mp.scss @@ -279,87 +279,6 @@ } } -.person-navigation { - max-height: 75dvh; - overflow-y: auto; - - &--subpage-heading { - text-underline-offset: 0.25rem; - h2 { - font-size: 0.9rem; - margin-bottom: 0; - } - } - - h3 { - font-size: 0.8rem; - padding: 0.5em 2em 0.5em 1em; - color: $primary-color; - margin-top: 0.25rem; - font-weight: bold; - } - - ul { - font-size: em-calc(18); - margin-left: 0px; - - li { - top: 1px; - position: relative; - line-height: 48px; - margin-left: 0px; - width: 100%; - a { - color: #6c6b68; - } - &.active{ - a { - color: #333; - } - h2 { - box-shadow: -2em 0em 0px $primary-color; - outline: 8px solid #fff; - } - } - - .subpage-content-list:last-child { - margin-bottom: -0.5em; - } - } - - .subpage-content-list { - display: none; - margin: 1rem 0; - margin-bottom: 0; - margin-top: 0.25rem; - background-color: transparent; - - h3 { - margin: 0; - } - - li { - padding: 0.5rem 0; - margin-left: 1em; - margin-bottom: 0; - font-size: 0.8rem; - border-bottom: 1px solid #f3f1eb; - width: 90%; - margin-right: 0; - } - } - - .active { - .subpage-content-list { - @media (min-width: $medium-screen) { - display: flex; - flex-direction: column; - } - } - } - } -} - .person-panels { padding-top: em-calc(36); clear: both; @@ -389,89 +308,6 @@ } } - .in-page-nav { - & > * { - @include radius(3px); - margin-bottom: 0px; - font-size: em-calc(16); - margin-bottom: 2.22222rem; - position: sticky; - top: 1rem; - z-index: 999; - } - - h3.browse-content { - margin-top: 0; - margin-bottom: 0; - padding: 0.5em 0.75em; - background: #9ddc93; - font-size: 1.1rem; - color: $body-font-color; - position: sticky; - top: 0; - z-index: 1; - } - - ul { - background-color: white; - margin-left: 0; - } - - li { - list-style-position: inside; - list-style: none; - padding: 0.5em 0.5em 0.5em 1em; - line-height: 1.3em; - color: $borders; - &.active { - color: $primary-color; - } - &:last-of-type { - border-bottom: 0px; - } - a { - color: $body-font-color; - } - } - - .featured_side__mysociety { - color: white; - background: #333333; - padding: 0.75em 1em; - } - - .featured_side__content, - .sidebar__unit__donation { - background-color: white; - padding: 0.5em 1em 1em; - margin-bottom: 1.11111em; - > *:last-child { - margin-bottom: 0; - } - @media (min-width: $medium-screen) { - margin-bottom: 2.22222em; - } - } - - .sidebar__newsletter-form { - input[type="email"], - .button { - height: 36px; - font-size: 0.9rem; - } - .sidebar__newsletter-form__footer { - font-size: 0.8rem; - > *:last-child { - margin-bottom: 0; - } - } - } - - .content__button { - margin-bottom: 0; - } - } - .panel { h2 { font-size: em-calc(30); diff --git a/www/docs/style/sass/parts/_in-page-nav.scss b/www/docs/style/sass/parts/_in-page-nav.scss new file mode 100644 index 0000000000..fa79206e0f --- /dev/null +++ b/www/docs/style/sass/parts/_in-page-nav.scss @@ -0,0 +1,189 @@ +.in-page-nav { + & > * { + @include radius(3px); + margin-bottom: 0px; + font-size: em-calc(16); + margin-bottom: 2.22222rem; + position: sticky; + top: 1rem; + z-index: 999; + } + + h2.browse-content { + margin-top: 0; + margin-bottom: 0; + padding: 0.5em 0.75em; + background: #9ddc93; + font-size: 1.1rem; + color: $body-font-color; + position: sticky; + top: 0; + z-index: 1; + } + + ul { + background-color: white; + margin-left: 0; + } + + li { + list-style-position: inside; + list-style: none; + padding: 0.5em 0.5em 0.5em 1em; + line-height: 1.3em; + color: $borders; + &.active { + color: $primary-color; + } + &:last-of-type { + border-bottom: 0px; + } + a { + color: $body-font-color; + } + } + + .featured_side__mysociety { + color: white; + background: #333333; + padding: 0.75em 1em; + } + + .featured_side__content, + .sidebar__unit__donation { + background-color: white; + padding: 0.5em 1em 1em; + margin-bottom: 1.11111em; + @media (min-width: $medium-screen) { + margin-bottom: 2.22222em; + } + } + + .sidebar__unit__featured_side { + display: none; + + @media (min-width: $medium-screen) { + display: block; + } + } + + .content__button { + margin-bottom: 0; + } +} + +.js-table-content-button { + position: fixed; + bottom: 1rem; + right: 1rem; + margin-bottom: 0; + + i { + margin-right: 0.25em; + } + + @media (min-width: $medium-screen) { + display: none; + } +} + +.js-table-of-content { + @media (max-width: $medium-screen) { + display: none; + position: fixed; + right: 1rem; + bottom: 4rem; + max-width: 300px; + width: 80dvw; + z-index: 999; + box-shadow: -1px 2px 5px 6px rgba(62, 62, 62, 0.3); + background-color: #fff; + } + + @media (min-width: $medium-screen) { + display: block; + width: auto; + } +} + +.table-of-content { + max-height: 75dvh; + overflow-y: auto; + + &--subpage-heading { + text-underline-offset: 0.25rem; + h3 { + font-size: 0.9rem; + margin-bottom: 0; + } + } + + h4 { + font-size: 0.8rem; + padding: 0.5em 2em 0.5em 1em; + color: $primary-color; + margin-top: 0.25rem; + font-weight: bold; + } + + ul { + font-size: em-calc(18); + margin-left: 0px; + + li { + top: 1px; + position: relative; + line-height: 48px; + margin-left: 0px; + width: 100%; + a { + color: #6c6b68; + } + &.active{ + a { + color: #333; + } + h3 { + box-shadow: -2em 0em 0px $primary-color; + outline: 8px solid #fff; + } + } + + .subpage-content-list:last-child { + margin-bottom: -0.5em; + } + } + + .subpage-content-list { + display: none; + margin: 1rem 0; + margin-bottom: 0; + margin-top: 0.25rem; + background-color: transparent; + + h4 { + margin: 0; + } + + li { + padding: 0.5rem 0; + margin-left: 1em; + margin-bottom: 0; + font-size: 0.8rem; + border-bottom: 1px solid #f3f1eb; + width: 90%; + margin-right: 0; + line-height: 0.8rem; + } + } + + .active { + .subpage-content-list { + @media (min-width: $medium-screen) { + display: flex; + flex-direction: column; + } + } + } + } +} diff --git a/www/docs/style/sass/parts/_table-of-contents.scss b/www/docs/style/sass/parts/_table-of-contents.scss deleted file mode 100644 index 400fd811c3..0000000000 --- a/www/docs/style/sass/parts/_table-of-contents.scss +++ /dev/null @@ -1,33 +0,0 @@ -.js-table-content-button { - position: fixed; - bottom: 1rem; - right: 1rem; - margin-bottom: 0; - - i { - margin-right: 0.25em; - } - - @media (min-width: $medium-screen) { - display: none; - } -} - -.js-table-of-content { - @media (max-width: $medium-screen) { - display: none; - position: fixed; - right: 1rem; - bottom: 4rem; - max-width: 300px; - width: 80dvw; - z-index: 999; - box-shadow: -1px 2px 5px 6px rgba(62, 62, 62, 0.3); - background-color: #fff; - } - - @media (min-width: $medium-screen) { - display: block; - width: auto; - } -} diff --git a/www/includes/easyparliament/templates/html/mp/_person_navigation.php b/www/includes/easyparliament/templates/html/mp/_person_navigation.php index f5f5c9dee3..3967a5bae5 100644 --- a/www/includes/easyparliament/templates/html/mp/_person_navigation.php +++ b/www/includes/easyparliament/templates/html/mp/_person_navigation.php @@ -4,12 +4,12 @@ -
-

+
+

From 0407f72134fa12f13ebf1a53afc2e3182684676e Mon Sep 17 00:00:00 2001 From: Lucas Cumsille M Date: Tue, 9 Jun 2026 15:07:48 +0000 Subject: [PATCH 5/9] Added responsive beahviour for children of `sidebar__unit` --- www/docs/style/sass/parts/_in-page-nav.scss | 37 ++++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/www/docs/style/sass/parts/_in-page-nav.scss b/www/docs/style/sass/parts/_in-page-nav.scss index fa79206e0f..d661e5add3 100644 --- a/www/docs/style/sass/parts/_in-page-nav.scss +++ b/www/docs/style/sass/parts/_in-page-nav.scss @@ -1,12 +1,27 @@ .in-page-nav { & > * { + display: flex; + align-items: center; + flex-wrap: wrap; + flex-direction: column; + gap: 1rem; @include radius(3px); margin-bottom: 0px; + margin-top: 1rem; font-size: em-calc(16); margin-bottom: 2.22222rem; position: sticky; - top: 1rem; + top: 0; z-index: 999; + + @media (min-width: $large-screen) { + align-items: normal; + margin-top: -1rem; // This is for the fist invisible child(.page-mobile-navigation-controller) that gives one extra space thanks to the gap:1rem; + } + + > * { + max-width: 22rem; + } } h2.browse-content { @@ -53,17 +68,20 @@ .sidebar__unit__donation { background-color: white; padding: 0.5em 1em 1em; - margin-bottom: 1.11111em; - @media (min-width: $medium-screen) { - margin-bottom: 2.22222em; - } } .sidebar__unit__featured_side { - display: none; + display: block; - @media (min-width: $medium-screen) { - display: block; + input { + font-size: 0.9rem; + } + } + + .sidebar__newsletter-form__footer { + font-size: 0.8rem; + > *:last-child { + margin-bottom: 0; } } @@ -128,7 +146,8 @@ ul { font-size: em-calc(18); - margin-left: 0px; + margin-left: 0; + margin-bottom: 0; li { top: 1px; From d86b06f1694d0eb05029c5b1db276f18f9f6e932 Mon Sep 17 00:00:00 2001 From: Lucas Cumsille M Date: Wed, 10 Jun 2026 13:34:05 +0000 Subject: [PATCH 6/9] Make _donation and _newsletter announcement reusable - Deleted the first line on each template so they can be reused and the variable `$featured_item` and `newsletter_item` can have different copies. - Updated `mp/_sidebar.php` so it uses the correct variable `$featured_item` --- www/includes/easyparliament/templates/html/mp/_sidebar.php | 2 +- .../easyparliament/templates/html/sidebar/_donation.php | 4 ---- .../easyparliament/templates/html/sidebar/_newsletter.php | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/www/includes/easyparliament/templates/html/mp/_sidebar.php b/www/includes/easyparliament/templates/html/mp/_sidebar.php index ed782d9b12..7c775f1a6a 100644 --- a/www/includes/easyparliament/templates/html/mp/_sidebar.php +++ b/www/includes/easyparliament/templates/html/mp/_sidebar.php @@ -1,7 +1,7 @@ -get_random_valid_item("sidebar", "donation"); ?> +get_random_valid_item("sidebar", "donation"); ?> get_random_valid_item("sidebar", "newsletter"); ?> diff --git a/www/includes/easyparliament/templates/html/sidebar/_donation.php b/www/includes/easyparliament/templates/html/sidebar/_donation.php index 6744501dcd..a460ec1e79 100644 --- a/www/includes/easyparliament/templates/html/sidebar/_donation.php +++ b/www/includes/easyparliament/templates/html/sidebar/_donation.php @@ -1,7 +1,3 @@ - - -get_random_valid_item("donation"); ?> -
From 5bc7febf301caab43f0750b8c274fbcdcfce4220 Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Fri, 19 Jun 2026 12:49:57 +0000 Subject: [PATCH 8/9] fixup! Make `person-navigation` a reusable component --- www/docs/style/sass/parts/_in-page-nav.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/www/docs/style/sass/parts/_in-page-nav.scss b/www/docs/style/sass/parts/_in-page-nav.scss index d661e5add3..bca0a1d861 100644 --- a/www/docs/style/sass/parts/_in-page-nav.scss +++ b/www/docs/style/sass/parts/_in-page-nav.scss @@ -150,7 +150,6 @@ margin-bottom: 0; li { - top: 1px; position: relative; line-height: 48px; margin-left: 0px; From a47573b56c1fad11cdd0f1406a7c22270aab6571 Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Fri, 19 Jun 2026 13:00:32 +0000 Subject: [PATCH 9/9] fixup! Make `person-navigation` a reusable component --- www/docs/style/sass/pages/_mp.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/docs/style/sass/pages/_mp.scss b/www/docs/style/sass/pages/_mp.scss index cdf0e06cae..90dbfbc6ed 100644 --- a/www/docs/style/sass/pages/_mp.scss +++ b/www/docs/style/sass/pages/_mp.scss @@ -299,11 +299,12 @@ // Recent votes page has sidebar *after* the primary content // (so that a list of content sections can be built up in $sidebar_links) // but we want to make sure the main content always displays on the right. + // The sidebar's lower order keeps it on the left regardless of DOM order. .primary-content__unit { @media (min-width: $medium-screen) { float: right; // non-flex fallback - order: 1; + order: 2; margin-top: 0; } }