8 changed files with 117 additions and 32 deletions
@ -0,0 +1,13 @@ |
|||||||
|
<nav class="app-tab-navigation" aria-label="sub menu"> |
||||||
|
<ul class="app-tab-navigation__list"> |
||||||
|
<% items.each do |item| %> |
||||||
|
<li class="app-tab-navigation__item"> |
||||||
|
<% if item.fetch(:current, false) || current_page?(strip_query(item.fetch(:url))) %> |
||||||
|
<%= govuk_link_to item[:name], item[:url], class: 'app-tab-navigation__link', aria: { current: 'page' } %> |
||||||
|
<% else %> |
||||||
|
<%= govuk_link_to item[:name], item[:url], class: 'app-tab-navigation__link' %> |
||||||
|
<% end %> |
||||||
|
</li> |
||||||
|
<% end %> |
||||||
|
</ul> |
||||||
|
</nav> |
@ -0,0 +1,13 @@ |
|||||||
|
class TabNavigationComponent < ViewComponent::Base |
||||||
|
attr_reader :items |
||||||
|
|
||||||
|
def initialize(items:) |
||||||
|
@items = items |
||||||
|
end |
||||||
|
|
||||||
|
def strip_query(url) |
||||||
|
url = Addressable::URI.parse(url) |
||||||
|
url.query_values = nil |
||||||
|
url.to_s |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,76 @@ |
|||||||
|
.app-tab-navigation { |
||||||
|
@include govuk-font(19, $weight: bold); |
||||||
|
@include govuk-responsive-margin(6, "bottom"); |
||||||
|
} |
||||||
|
|
||||||
|
.app-tab-navigation__list { |
||||||
|
@include govuk-clearfix; |
||||||
|
// left: govuk-spacing(-3); |
||||||
|
list-style: none; |
||||||
|
margin: 0; |
||||||
|
padding: 0; |
||||||
|
position: relative; |
||||||
|
// right: govuk-spacing(-3); |
||||||
|
width: calc(100% + #{govuk-spacing(6)}); |
||||||
|
|
||||||
|
@include govuk-media-query($from: tablet) { |
||||||
|
box-shadow: inset 0 -1px 0 $govuk-border-colour; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.app-tab-navigation__item { |
||||||
|
box-sizing: border-box; |
||||||
|
display: block; |
||||||
|
line-height: 40px; |
||||||
|
height: 40px; |
||||||
|
padding: 0 govuk-spacing(3); |
||||||
|
|
||||||
|
@include govuk-media-query($from: tablet) { |
||||||
|
box-shadow: none; |
||||||
|
display: block; |
||||||
|
float: left; |
||||||
|
line-height: 50px; |
||||||
|
height: 50px; |
||||||
|
padding: 0 govuk-spacing(3); |
||||||
|
position: relative; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.app-tab-navigation__item--current { |
||||||
|
@include govuk-media-query($until: tablet) { |
||||||
|
border-left: 4px solid $govuk-link-colour; |
||||||
|
padding-left: 11px; |
||||||
|
} |
||||||
|
|
||||||
|
@include govuk-media-query($from: tablet) { |
||||||
|
border-bottom: 4px solid $govuk-link-colour; |
||||||
|
padding-left: govuk-spacing(3); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.app-tab-navigation__link { |
||||||
|
@include govuk-link-common; |
||||||
|
@include govuk-link-style-no-visited-state; |
||||||
|
@include govuk-link-style-no-underline; |
||||||
|
@include govuk-typography-weight-bold; |
||||||
|
|
||||||
|
&:not(:focus):hover { |
||||||
|
color: $govuk-link-colour; |
||||||
|
} |
||||||
|
|
||||||
|
// Extend the touch area of the link to the list |
||||||
|
&:after { |
||||||
|
bottom: 0; |
||||||
|
content: ""; |
||||||
|
left: 0; |
||||||
|
position: absolute; |
||||||
|
right: 0; |
||||||
|
top: 0; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.app-tab-navigation__item--current .app-tab-navigation__link { |
||||||
|
&:hover { |
||||||
|
text-decoration: none; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
<%= govuk_summary_list do |summary_list| %> |
||||||
|
<% @organisation.display_attributes.each do |attr, val| %> |
||||||
|
<%= summary_list.row do |row| |
||||||
|
row.key { attr.to_s.humanize } |
||||||
|
row.value { simple_format(val, {}, wrapper_tag: "div") } |
||||||
|
end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
Loading…
Reference in new issue