Skip to content

Commit a79bb53

Browse files
authored
Merge pull request #4014 from nhsuk/fix-heading-levels
Review heading levels and sizes
2 parents ae2117d + 95aebfe commit a79bb53

42 files changed

Lines changed: 103 additions & 82 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/components/app_activity_log_component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
class AppActivityLogComponent < ViewComponent::Base
44
erb_template <<-ERB
55
<% events_by_day.each do |day, events| %>
6-
<h2 class="nhsuk-heading-xs nhsuk-u-secondary-text-color
6+
<h3 class="nhsuk-heading-xs nhsuk-u-secondary-text-color
77
nhsuk-u-font-weight-normal">
88
<%= day.to_fs(:long) %>
9-
</h2>
9+
</h3>
1010
1111
<% events.each do |event| %>
1212
<%= render AppLogEventComponent.new(card: true, **event) %>

app/components/app_card_component.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ class AppCardComponent < ViewComponent::Base
55
<<%= top_level_tag %> class="<%= card_classes %>">
66
<div class="<%= content_classes %>">
77
<% if heading.present? %>
8-
<h2 class="<%= heading_classes %>">
8+
<h<%= @heading_level %> class="<%= heading_classes %>">
99
<% if @link_to.present? %>
1010
<%= link_to @link_to, class: "nhsuk-card__link" do %>
1111
<%= heading %>
1212
<% end %>
1313
<% else %>
1414
<%= heading %>
1515
<% end %>
16-
</h2>
16+
</h<%= @heading_level %>>
1717
<% end %>
1818
1919
<% if description.present? %>
@@ -31,6 +31,7 @@ class AppCardComponent < ViewComponent::Base
3131
def initialize(
3232
colour: nil,
3333
link_to: nil,
34+
heading_level: 3,
3435
secondary: false,
3536
data: false,
3637
compact: false,
@@ -41,6 +42,7 @@ def initialize(
4142

4243
@link_to = link_to
4344
@colour = colour
45+
@heading_level = heading_level
4446
@secondary = secondary
4547
@data = data
4648
@compact = compact
@@ -77,10 +79,10 @@ def content_classes
7779
].compact.join(" ")
7880
end
7981

80-
def heading_size
82+
def heading_modifier
8183
if @data
8284
"xs"
83-
elsif @feature || @secondary || @compact
85+
elsif @secondary || @compact
8486
"s"
8587
else
8688
"m"
@@ -90,7 +92,7 @@ def heading_size
9092
def heading_classes
9193
[
9294
"nhsuk-card__heading",
93-
"nhsuk-heading-#{heading_size}",
95+
"nhsuk-heading-#{heading_modifier}",
9496
("nhsuk-card__heading--feature" if @feature)
9597
].compact.join(" ")
9698
end

app/components/app_compare_consent_form_and_patient_component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ class AppCompareConsentFormAndPatientComponent < ViewComponent::Base
44
erb_template <<-ERB
55
<div class="nhsuk-grid-row nhsuk-card-group">
66
<div class="nhsuk-grid-column-one-half nhsuk-card-group__item">
7-
<%= render AppCardComponent.new(colour: "blue") do |card| %>
7+
<%= render AppCardComponent.new(heading_level: 2, colour: "blue") do |card| %>
88
<% card.with_heading { "Consent response" } %>
99
<%= govuk_summary_list(rows: consent_form_rows) %>
1010
<% end %>
1111
</div>
1212
1313
<div class="nhsuk-grid-column-one-half nhsuk-card-group__item">
14-
<%= render AppCardComponent.new(colour: "blue") do |card| %>
14+
<%= render AppCardComponent.new(heading_level: 2, colour: "blue") do |card| %>
1515
<% card.with_heading { "Child record" } %>
1616
<%= govuk_summary_list(rows: patient_rows) %>
1717
<% end %>

app/components/app_consent_card_component.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def link_to
2525
session_patient_programme_consent_path(session, patient, programme, consent)
2626
end
2727

28-
def card_options = { link_to:, colour: "offset", compact: true }
28+
def card_options =
29+
{ link_to:, heading_level: 6, colour: "offset", compact: true }
2930

3031
def heading
3132
if consent.via_self_consent?

app/components/app_consent_form_card_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def initialize(consent_form)
88
end
99

1010
def call
11-
render AppCardComponent.new do |card|
11+
render AppCardComponent.new(heading_level: 2) do |card|
1212
card.with_heading { "Consent response" }
1313

1414
govuk_summary_list do |summary_list|

app/components/app_gillick_assessment_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% if gillick_assessment || can_assess? %>
2-
<h3 class="nhsuk-heading-s nhsuk-u-margin-bottom-3">Gillick assessment</h3>
2+
<h5 class="nhsuk-heading-s">Gillick assessment</h5>
33

44
<% if gillick_assessment %>
55
<% if gillick_assessment.gillick_competent? %>

app/components/app_health_answers_card_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(objects, heading: "Answers to health questions")
99
end
1010

1111
def call
12-
render AppCardComponent.new do |card|
12+
render AppCardComponent.new(heading_level: 2) do |card|
1313
card.with_heading { heading }
1414
render AppHealthAnswersSummaryComponent.new(objects)
1515
end

app/components/app_log_event_component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ class AppLogEventComponent < ViewComponent::Base
77
<% end %>
88
99
<% if title.present? %>
10-
<h3 class="<% if card %>nhsuk-card__heading <% end %>nhsuk-heading-s">
10+
<h4 class="<% if card %>nhsuk-card__heading <% end %>nhsuk-heading-s">
1111
<%= invalidated ? tag.s(title) : title %>
12-
</h3>
12+
</h4>
1313
<% end %>
1414
1515
<% if body.present? %>

app/components/app_parent_card_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(parent_relationship:, change_links: {})
99
end
1010

1111
def call
12-
render AppCardComponent.new do |card|
12+
render AppCardComponent.new(heading_level: 2) do |card|
1313
card.with_heading { "Parent or guardian" }
1414
render AppParentSummaryComponent.new(parent_relationship:, change_links:)
1515
end

app/components/app_patient_card_component.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class AppPatientCardComponent < ViewComponent::Base
44
erb_template <<-ERB
5-
<%= render AppCardComponent.new(section: true) do |card| %>
5+
<%= render AppCardComponent.new(heading_level:, section: true) do |card| %>
66
<% card.with_heading { "Child’s details" } %>
77
88
<% if patient.date_of_death.present? %>
@@ -29,15 +29,16 @@ class AppPatientCardComponent < ViewComponent::Base
2929
<% end %>
3030
ERB
3131

32-
def initialize(patient, change_links: {}, remove_links: {})
32+
def initialize(patient, change_links: {}, remove_links: {}, heading_level: 3)
3333
super
3434

3535
@patient = patient
3636
@change_links = change_links
3737
@remove_links = remove_links
38+
@heading_level = heading_level
3839
end
3940

4041
private
4142

42-
attr_reader :patient, :change_links, :remove_links
43+
attr_reader :patient, :change_links, :remove_links, :heading_level
4344
end

0 commit comments

Comments
 (0)