From 379ecb97ad43f2c3fde8e780d022f680217a85ae Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 26 Jul 2024 12:53:44 +0100 Subject: [PATCH 1/5] Force content to print full width if there's no sidebar content If there's only one child element inside the row element, we can assume there's only one column of content. We set the column back to auto width and non-floated, rather than using widths/floats it might have obtained from the design system. --- app/assets/stylesheets/smart_answers.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/assets/stylesheets/smart_answers.scss b/app/assets/stylesheets/smart_answers.scss index 8060fd9c258..c7639e169a7 100644 --- a/app/assets/stylesheets/smart_answers.scss +++ b/app/assets/stylesheets/smart_answers.scss @@ -40,5 +40,13 @@ padding: govuk-spacing(2); } } + + // stylelint-disable selector-max-id + & > #content > .govuk-grid-row > :only-child { + float: none; + width: auto; + } + // stylelint-enable selector-max-id + } } From 618ad8444ede1025290b5b5c5326be68df8106ea Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 26 Jul 2024 12:56:33 +0100 Subject: [PATCH 2/5] Hide the invitation to 'Change your answers' --- .../smart_answers/custom_result.html.erb | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/views/smart_answers/custom_result.html.erb b/app/views/smart_answers/custom_result.html.erb index 60b664da915..5bf12e51c95 100644 --- a/app/views/smart_answers/custom_result.html.erb +++ b/app/views/smart_answers/custom_result.html.erb @@ -36,18 +36,20 @@ <%= outcome.body %> - <%= render "govuk_publishing_components/components/heading", { - text: "Change your answers", - font_size: "l", - border_top: 2, - padding: true - } %> - - <%= tag.p class: "govuk-body govuk-!-margin-bottom-8" do %> - <%= link_to "Answer the questions again to change the results", - restart_flow_path(@presenter), - class: "govuk-link" %> - <% end %> +
+ <%= render "govuk_publishing_components/components/heading", { + text: "Change your answers", + font_size: "l", + border_top: 2, + padding: true + } %> + + <%= tag.p class: "govuk-body govuk-!-margin-bottom-8" do %> + <%= link_to "Answer the questions again to change the results", + restart_flow_path(@presenter), + class: "govuk-link" %> + <% end %> +
<%= render 'govuk_publishing_components/components/print_link' %> From 304b187e5851e3b828fedac1b72a72544041d9f4 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 26 Jul 2024 12:54:49 +0100 Subject: [PATCH 3/5] `result_sections` component print styles - improve the spacing - remove doubled-up borders --- .../stylesheets/components/_result-sections.scss | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/assets/stylesheets/components/_result-sections.scss b/app/assets/stylesheets/components/_result-sections.scss index e90a2ae0b36..b7bc96e8261 100644 --- a/app/assets/stylesheets/components/_result-sections.scss +++ b/app/assets/stylesheets/components/_result-sections.scss @@ -9,3 +9,17 @@ @include govuk-responsive-padding(4, "top"); border-top: 1px solid $govuk-border-colour; } + +@include govuk-media-query($media-type: print) { + .app-c-result-sections { + margin-bottom: 1.5cm; + } + + .app-c-result-sections__section { + border-top: 0; + + &:not(:last-of-type) { + border-bottom: 1px solid $govuk-border-colour; + } + } +} From 63d41df4ff4c183a911815c265bfd2aeba2cf72c Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 26 Jul 2024 12:58:20 +0100 Subject: [PATCH 4/5] `result_card` component print styles - Force colours to black - Prevent elements printing across a page break - Simplify borders --- .../stylesheets/components/_result-card.scss | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/assets/stylesheets/components/_result-card.scss b/app/assets/stylesheets/components/_result-card.scss index a83c450ae9c..47660312ca1 100644 --- a/app/assets/stylesheets/components/_result-card.scss +++ b/app/assets/stylesheets/components/_result-card.scss @@ -44,3 +44,19 @@ .app-c-result-card__link { @include govuk-font($size: 19, $weight: bold); } + +@include govuk-media-query($media-type: print) { + .app-c-result-card { + break-inside: avoid; + border: 1pt solid $govuk-print-text-colour; + + &::before { + display: none; + } + + .app-c-result-card__link, + .app-c-result-card__link:link { + color: $govuk-print-text-colour; + } + } +} From 49c6ad50696ddc1bd9409caa4626b2438ff33e68 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 26 Jul 2024 12:59:42 +0100 Subject: [PATCH 5/5] `result_item` component print styles - Prevent element from printing across a page break - Remove background colour - Force all colours to black - Hide 'opens in new tab' text - Wrap printed URLs to a new line for easier reading --- .../stylesheets/components/_result-item.scss | 23 +++++++++++++++++++ app/views/components/_result_item.html.erb | 7 +++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/components/_result-item.scss b/app/assets/stylesheets/components/_result-item.scss index e027499260b..408fc992294 100644 --- a/app/assets/stylesheets/components/_result-item.scss +++ b/app/assets/stylesheets/components/_result-item.scss @@ -11,3 +11,26 @@ border-left: 5px solid govuk-colour("blue"); padding: govuk-spacing(3); } + +// stylelint-disable declaration-no-important +@include govuk-media-query($media-type: print) { + .app-c-result-item { + break-inside: avoid; + border-color: $govuk-print-text-colour; + + .govuk-link::after { + display: block; + margin-top: 1mm; + font-size: 12pt; + } + } + + .app-c-result-item--highlighted { + background-color: initial; + + a,a:link { + color: $govuk-print-text-colour !important; + } + } +} +// stylelint-enable declaration-no-important diff --git a/app/views/components/_result_item.html.erb b/app/views/components/_result_item.html.erb index df913af354f..a1e9df6ea1e 100644 --- a/app/views/components/_result_item.html.erb +++ b/app/views/components/_result_item.html.erb @@ -14,10 +14,9 @@ %> <%= tag.div class: css_classes do %>

- <%= link_to (title + " (opens in new tab)" if title.present?), url, - class: "govuk-link", - target: "_blank", - rel: "noreferrer noopener" %> + <%= link_to url, class: "govuk-link", target: "_blank", rel: "noreferrer noopener" do %> + <%= title || url %> (opens in new tab) + <% end %>

<%= description %>