Skip to content

Commit

Permalink
BREAKING: Remove title component
Browse files Browse the repository at this point in the history
- Removes the title component, as we now use the heading component where titles are needed.
- Also replaces gem-c-title references with gem-c-heading in the inverse_header and select component
- Also replaces references to the title component in spec files so that tests pass
  • Loading branch information
AshGDS committed Feb 26, 2025
1 parent 0e38e56 commit 3dfb20e
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 277 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

## Unreleased

* **BREAKING:** Remove title component ([PR #4653](https://github.com/alphagov/govuk_publishing_components/pull/4653))
* Fix bottom border colour issue in the super nav search button ([PR #4642](https://github.com/alphagov/govuk_publishing_components/pull/4642))
* Use govuk-spacing instead of govuk-gutter ([PR #4650](https://github.com/alphagov/govuk_publishing_components/pull/4650))
* Ensure 'search with autocomplete' component uses its own margin bottom ([PR #4637](https://github.com/alphagov/govuk_publishing_components/pull/4637))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,5 @@
@import "components/tabs";
@import "components/table";
@import "components/textarea";
@import "components/title";
@import "components/translation-nav";
@import "components/warning-text";

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
<% if select_helper.options.any? && id && label %>
<%= content_tag :div, class: select_helper.css_classes do %>
<% if is_page_heading %>
<% add_gem_component_stylesheet("title") %>
<%= tag.h1 label_tag(id, label, class: select_helper.label_classes), class: "gem-c-title__text" %>
<% add_gem_component_stylesheet("heading") %>
<%= render "govuk_publishing_components/components/heading", {
text: label_tag(id, label, class: select_helper.label_classes),
heading_level: 1
} %>
<% else %>
<%= label_tag(id, label, class: select_helper.label_classes) %>
<% end %>
Expand Down
38 changes: 0 additions & 38 deletions app/views/govuk_publishing_components/components/_title.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ examples:
inverse: true
context:
dark_background: true
with_nested_html:
description: HTML can be rendered within the heading as shown.
data:
text: <label>This is a label element</label>
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ examples:
data:
block: |
<!-- example content -->
<%= render "govuk_publishing_components/components/title", {
title: "Education, Training and Skills",
inverse: true
<%= render "govuk_publishing_components/components/heading", {
text: "Education, Training and Skills",
font_size: "xl",
inverse: true,
padding: true,
} %>
<!-- end of example content -->
with_custom_padding:
Expand All @@ -38,9 +40,11 @@ examples:
full_width: true
block: |
<!-- example content -->
<%= render "govuk_publishing_components/components/title", {
title: "Education, Training and Skills",
inverse: true
<%= render "govuk_publishing_components/components/heading", {
text: "Education, Training and Skills",
font_size: "xl",
inverse: true,
padding: true,
} %>
<!-- end of example content -->
with_subtext:
Expand All @@ -59,10 +63,12 @@ examples:
data:
block: |
<!-- example content -->
<%= render "govuk_publishing_components/components/title", {
title: "LN5 0AT, Jackson Homes (Scopwick) Ltd: environmental permit application",
<%= render "govuk_publishing_components/components/heading", {
text: "LN5 0AT, Jackson Homes (Scopwick) Ltd: environmental permit application",
inverse: true,
context: "Notice",
padding: true,
font_size: "xl"
} %>
<p class="publication-header__last-changed">Published 22 April 2016</p>
<!-- end of example content -->
Expand Down
64 changes: 0 additions & 64 deletions app/views/govuk_publishing_components/components/docs/title.yml

This file was deleted.

20 changes: 10 additions & 10 deletions spec/component_guide/audit_applications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
components_found: [
{
location: "template",
components: ["accordion", "back link", "contextual breadcrumbs", "contextual footer", "contextual sidebar", "details", "error summary", "feedback", "govspeak", "input", "layout footer", "layout for admin", "layout for public", "layout header", "notice", "skip link", "tabs", "title"],
components: ["accordion", "back link", "contextual breadcrumbs", "contextual footer", "contextual sidebar", "details", "error summary", "feedback", "govspeak", "heading", "input", "layout footer", "layout for admin", "layout for public", "layout header", "notice", "skip link", "tabs"],
},
{
location: "stylesheet",
Expand Down Expand Up @@ -47,6 +47,15 @@
feedback: ["app/views/layouts/application.html.erb"],
govspeak: ["app/views/welcome/contextual_navigation.html.erb", "lib/1_test_file_1.rb"],
input: ["app/views/welcome/error_summary.html.erb", "app/views/welcome/error_summary.html.erb"],
heading:
[
"app/views/welcome/asset_helper.html.erb",
"app/views/welcome/asset_helper_with_app_component.html.erb",
"app/views/welcome/asset_helper_with_app_view.html.erb",
"app/views/welcome/contextual_navigation.html.erb",
"app/views/welcome/error_summary.html.erb",
"app/views/welcome/table.html.erb",
],
"layout footer": ["app/views/layouts/dummy_admin_layout.html.erb"],
"layout for admin": ["app/views/layouts/dummy_admin_layout.html.erb"],
"layout for public": ["app/views/layouts/dummy_public_layout.html.erb"],
Expand All @@ -60,15 +69,6 @@
"app/views/welcome/asset_helper_with_app_view.html.erb",
],
tabs: ["app/views/welcome/error_summary.html.erb", "app/views/welcome/tabs_example.html.erb"],
title:
[
"app/views/welcome/asset_helper.html.erb",
"app/views/welcome/asset_helper_with_app_component.html.erb",
"app/views/welcome/asset_helper_with_app_view.html.erb",
"app/views/welcome/contextual_navigation.html.erb",
"app/views/welcome/error_summary.html.erb",
"app/views/welcome/table.html.erb",
],
},
helper_references: {
BrandHelper: ["lib/test_file_3.rb"],
Expand Down
4 changes: 2 additions & 2 deletions spec/component_guide/component_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
@import 'govuk_publishing_components/components/error-summary';
@import 'govuk_publishing_components/components/feedback';
@import 'govuk_publishing_components/components/govspeak';
@import 'govuk_publishing_components/components/heading';
@import 'govuk_publishing_components/components/hint';
@import 'govuk_publishing_components/components/input';
@import 'govuk_publishing_components/components/label';
Expand All @@ -77,8 +78,7 @@
@import 'govuk_publishing_components/components/step-by-step-nav-header';
@import 'govuk_publishing_components/components/step-by-step-nav-related';
@import 'govuk_publishing_components/components/tabs';
@import 'govuk_publishing_components/components/textarea';
@import 'govuk_publishing_components/components/title';"
@import 'govuk_publishing_components/components/textarea';"

expect(page).to have_selector(".component-doc-h2", text: "Gem components used by this app (20)")
expect(page).to have_selector(".govuk-details__summary-text", text: "Suggested imports for this application")
Expand Down
8 changes: 4 additions & 4 deletions spec/components/inverse_header_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require "rails_helper"

def block
"<div class=\"gem-c-title gem-c-title--inverse\">
<p class=\"gem-c-title__context\">
"<div class=\"gem-c-heading gem-c-heading-inverse\">
<p class=\"gem-c-heading__context\">
Publication
</p>
<h1 class=\"gem-c-title__text \">
<h1 class=\"gem-c-heading__text \">
HTML publication page title
</h1>
</div>".html_safe
Expand All @@ -23,7 +23,7 @@ def component_name
it "renders content within a wrapper when content is provided" do
render_component({}) { block }

assert_select ".gem-c-inverse-header div.gem-c-title"
assert_select ".gem-c-inverse-header div.gem-c-heading"
assert_select ".gem-c-inverse-header h1", text: "HTML publication page title"
end

Expand Down
2 changes: 1 addition & 1 deletion spec/components/select_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,6 @@ def component_name
)

assert_select "select[name=colour]"
assert_select ".gem-c-select h1.gem-c-title__text label.govuk-label"
assert_select ".gem-c-select h1.gem-c-heading__text label.govuk-label"
end
end
Loading

0 comments on commit 3dfb20e

Please sign in to comment.