Skip to content

Commit

Permalink
Allow showing individual global bar links
Browse files Browse the repository at this point in the history
It's possible that we might want to show only one of the Brexit/Covid links
that are on the global bar.

This PR allows this and makes the margin underneath the upper link dependent
on whether there is anything below it.
  • Loading branch information
sihugh committed Mar 9, 2021
1 parent 82a77a9 commit 88e6ed4
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app/views/notifications/_global_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
link_text = false
link_href = false

show_coronavirus_link = true
coronavirus_title = "Coronavirus (COVID-19)"
coronavirus_href = "/coronavirus"
coronavirus_subtext = "National lockdown: stay at home"

show_transition_link = true
transition_title = "Brexit"
transition_href = "/transition"
transition_subtext = "Check what you need to do"

coronavirus_link_margin_bottom = show_transition_link ? { margin_bottom: 3 } : {}

# Toggles banner being permanently visible
# If true, banner is always_visible & does not disappear automatically after 3 pageviews
# Regardless of value, banner is always manually dismissable by users
Expand Down Expand Up @@ -66,18 +70,23 @@
</p>
<% end %>

<% if coronavirus_title && coronavirus_href %>
<% if show_coronavirus_link || show_transition_link %>
<div class="global-bar-covid-wrapper">
<% end %>

<% if show_coronavirus_link %>
<%= render "govuk_publishing_components/components/action_link", {
text: coronavirus_title,
href: coronavirus_href,
subtext: coronavirus_subtext,
classes: "js-call-to-action",
light_text: true,
simple_light: true,
margin_bottom: 3
} %>
}.merge(coronavirus_link_margin_bottom)
%>
<% end %>

<% if show_transition_link %>
<%= render "govuk_publishing_components/components/action_link", {
text: transition_title,
href: transition_href,
Expand All @@ -86,6 +95,9 @@
light_text: true,
simple_light: true
} %>
<% end %>

<% if show_coronavirus_link || show_transition_link %>
</div>
<% end %>
</div>
Expand Down

0 comments on commit 88e6ed4

Please sign in to comment.