From aca9a5798c9c59a6f7b4283c68eda057a9c3b776 Mon Sep 17 00:00:00 2001 From: AshGDS <8880610+AshGDS@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:04:51 +0000 Subject: [PATCH] Rename print link classes to fix conflict --- CHANGELOG.md | 4 ++++ .../govuk_publishing_components/lib/_print_support.scss | 8 ++++---- .../components/_action_link.html.erb | 2 +- .../components/_cards.html.erb | 2 +- .../components/_contents_list.html.erb | 2 +- .../components/_devolved_nations.html.erb | 2 +- .../components/_document_list.html.erb | 4 ++-- .../components/_image_card.html.erb | 4 ++-- .../components/_inset_text.html.erb | 2 +- .../components/_intervention.html.erb | 2 +- .../components/_step_by_step_nav_header.html.erb | 2 +- .../components/_step_by_step_nav_related.html.erb | 4 ++-- 12 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74140d1081..9116c82296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ useful summary for people upgrading their application, not a replication of the commit log. +## Unreleased + +* Rename print link classes to fix conflict ([PR #4407](https://github.com/alphagov/govuk_publishing_components/pull/4407)) + ## 45.4.0 * Chat entry component design changes ([PR #4399](https://github.com/alphagov/govuk_publishing_components/pull/4399)) diff --git a/app/assets/stylesheets/govuk_publishing_components/lib/_print_support.scss b/app/assets/stylesheets/govuk_publishing_components/lib/_print_support.scss index 1bbd59fdb4..56c58b2e3a 100644 --- a/app/assets/stylesheets/govuk_publishing_components/lib/_print_support.scss +++ b/app/assets/stylesheets/govuk_publishing_components/lib/_print_support.scss @@ -36,13 +36,13 @@ // to black, reduce the font size, and improve the layout // of the printed href. // -// .gem-c-print-link +// .gem-c-force-print-link-styles // ---------------------------------------------------------- // Typically this class will be applied to existing // elements that have the `govuk-link` class but it can // also be used on other link elements. // -// .gem-c-print-links-within +// .gem-c-force-print-link-styles-within // ---------------------------------------------------------- // A variation of the previous print style, to be used on // parent elements that contain links with the `govuk-link` @@ -52,8 +52,8 @@ // stylelint-disable declaration-no-important @include govuk-media-query($media-type: print) { - .gem-c-print-link, - .gem-c-print-links-within .govuk-link { + .gem-c-force-print-link-styles, + .gem-c-force-print-link-styles-within .govuk-link { &, &:link, &:visited { diff --git a/app/views/govuk_publishing_components/components/_action_link.html.erb b/app/views/govuk_publishing_components/components/_action_link.html.erb index 48a305dad8..cdebf98ef8 100644 --- a/app/views/govuk_publishing_components/components/_action_link.html.erb +++ b/app/views/govuk_publishing_components/components/_action_link.html.erb @@ -28,7 +28,7 @@ css_classes << "gem-c-action-link--mobile-subtext" if mobile_subtext css_classes << shared_helper.get_margin_bottom - link_classes = %w(govuk-link gem-c-action-link__link gem-c-print-link) + link_classes = %w(govuk-link gem-c-action-link__link gem-c-force-print-link-styles) link_classes << "govuk-link--inverse" if inverse component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) diff --git a/app/views/govuk_publishing_components/components/_cards.html.erb b/app/views/govuk_publishing_components/components/_cards.html.erb index 936d8e2c3f..a749bd3703 100644 --- a/app/views/govuk_publishing_components/components/_cards.html.erb +++ b/app/views/govuk_publishing_components/components/_cards.html.erb @@ -38,7 +38,7 @@ <%= content_tag("h#{sub_heading_level}", class: "gem-c-cards__sub-heading govuk-heading-s") do %> <%= link_to link[:text], link[:path], - class: "govuk-link gem-c-cards__link gem-c-print-link", + class: "govuk-link gem-c-cards__link gem-c-force-print-link-styles", data: link[:data_attributes] %> <% end %> diff --git a/app/views/govuk_publishing_components/components/_contents_list.html.erb b/app/views/govuk_publishing_components/components/_contents_list.html.erb index 1c3857291f..cd887b4a60 100644 --- a/app/views/govuk_publishing_components/components/_contents_list.html.erb +++ b/app/views/govuk_publishing_components/components/_contents_list.html.erb @@ -13,7 +13,7 @@ cl_helper = GovukPublishingComponents::Presenters::ContentsListHelper.new(local_assigns) brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand) - link_classes = %w[gem-c-contents-list__link govuk-link gem-c-print-link] + link_classes = %w[gem-c-contents-list__link govuk-link gem-c-force-print-link-styles] link_classes << brand_helper.color_class link_classes << "govuk-link--no-underline" unless underline_links diff --git a/app/views/govuk_publishing_components/components/_devolved_nations.html.erb b/app/views/govuk_publishing_components/components/_devolved_nations.html.erb index 97812c0bdc..215c49ccf4 100644 --- a/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +++ b/app/views/govuk_publishing_components/components/_devolved_nations.html.erb @@ -35,7 +35,7 @@ <% if devolved_nations_helper.nations_with_urls.any? %> <%= content_tag :ul, class: "govuk-list govuk-!-margin-top-1 govuk-!-margin-bottom-0" do -%> <% devolved_nations_helper.nations_with_urls.each do |k, v| %> - <%= content_tag(:li, link_to(devolved_nations_helper.alternative_content_text(k), v[:alternative_url], class: "govuk-link gem-c-print-link")) %> + <%= content_tag(:li, link_to(devolved_nations_helper.alternative_content_text(k), v[:alternative_url], class: "govuk-link gem-c-force-print-link-styles")) %> <% end %> <% end %> <% end %> diff --git a/app/views/govuk_publishing_components/components/_document_list.html.erb b/app/views/govuk_publishing_components/components/_document_list.html.erb index 2d521e9adc..09581b1b68 100644 --- a/app/views/govuk_publishing_components/components/_document_list.html.erb +++ b/app/views/govuk_publishing_components/components/_document_list.html.erb @@ -57,7 +57,7 @@ item[:link][:text], item[:link][:path], data: item[:link][:data_attributes], - class: "#{item_classes} govuk-link gem-c-print-link #{extra_link_classes}", + class: "#{item_classes} govuk-link gem-c-force-print-link-styles #{extra_link_classes}", lang: item[:link][:locale].presence, rel: rel, ) @@ -118,7 +118,7 @@ part[:link][:text], part[:link][:path], data: part[:link][:data_attributes], - class: "gem-c-document-list-child__heading gem-c-document-list-child__link #{brand_helper.color_class} govuk-link gem-c-print-link #{extra_link_classes}", + class: "gem-c-document-list-child__heading gem-c-document-list-child__link #{brand_helper.color_class} govuk-link gem-c-force-print-link-styles #{extra_link_classes}", ) else content_tag( diff --git a/app/views/govuk_publishing_components/components/_image_card.html.erb b/app/views/govuk_publishing_components/components/_image_card.html.erb index be395a3c81..5e972445b7 100644 --- a/app/views/govuk_publishing_components/components/_image_card.html.erb +++ b/app/views/govuk_publishing_components/components/_image_card.html.erb @@ -25,14 +25,14 @@ heading_link_classes = %w[ gem-c-image-card__title-link govuk-link - gem-c-print-link + gem-c-force-print-link-styles ] heading_link_classes << brand_helper.color_class heading_link_classes << "gem-c-image-card__title-link--large-font-size-mobile" if card_helper.large_mobile_font_size? extra_link_classes = %w[ gem-c-image-card__list-item-link govuk-link - gem-c-print-link + gem-c-force-print-link-styles ] extra_link_classes << brand_helper.color_class diff --git a/app/views/govuk_publishing_components/components/_inset_text.html.erb b/app/views/govuk_publishing_components/components/_inset_text.html.erb index a7d5018903..19934bb788 100644 --- a/app/views/govuk_publishing_components/components/_inset_text.html.erb +++ b/app/views/govuk_publishing_components/components/_inset_text.html.erb @@ -11,7 +11,7 @@ }) component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) - component_helper.add_class("gem-c-inset-text govuk-inset-text gem-c-print-links-within") + component_helper.add_class("gem-c-inset-text govuk-inset-text gem-c-force-print-link-styles-within") component_helper.add_class(shared_helper.get_margin_top) component_helper.add_class(shared_helper.get_margin_bottom) component_helper.set_id(id) diff --git a/app/views/govuk_publishing_components/components/_intervention.html.erb b/app/views/govuk_publishing_components/components/_intervention.html.erb index 91cd4c75a5..39fdfd4708 100644 --- a/app/views/govuk_publishing_components/components/_intervention.html.erb +++ b/app/views/govuk_publishing_components/components/_intervention.html.erb @@ -38,7 +38,7 @@ data_attributes[:ga4_intervention_banner] = "" unless disable_ga4 # Added to the parent element for the GA4 pageview object to use suggestion_tag_options = { - class: "govuk-link gem-c-print-link", + class: "govuk-link gem-c-force-print-link-styles", href: suggestion_link_url, data: suggestion_data_attributes, } diff --git a/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb b/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb index 2a209bf685..fd066cbbf5 100644 --- a/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +++ b/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb @@ -35,7 +35,7 @@ Part of <% if path %> data-ga4-link='<%= ga4_data %>' <% end %> diff --git a/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb b/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb index 07cd00282b..557b6afd83 100644 --- a/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +++ b/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb @@ -15,7 +15,7 @@ <%= pretitle %> <% if links.length == 1 && !always_display_as_list %>