Skip to content

Commit

Permalink
Merge pull request #557 from alphagov/environment-flag
Browse files Browse the repository at this point in the history
Update the header
  • Loading branch information
tijmenb committed Oct 3, 2018
2 parents 74790d3 + 454a4a0 commit 96129e1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 16 deletions.
@@ -1,6 +1,10 @@
@import "helpers/govuk-frontend-settings";
@import "govuk-frontend/components/header/header";

.gem-c-layout-header--production .govuk-header__container {
border-bottom-color: govuk-colour("bright-red");
}

.gem-c-layout-header--integration .govuk-header__container,
.gem-c-layout-header--staging .govuk-header__container {
border-bottom-color: govuk-colour("yellow");
Expand All @@ -10,3 +14,36 @@
.gem-c-layout-header--test .govuk-header__container {
border-bottom-color: govuk-colour("grey-1");
}

.govuk-header__logo {
white-space: nowrap;
}

.govuk-header__product-name {
display: none;

@include govuk-media-query($from: tablet) {
display: inline-block;
}
}

.gem-c-environment-tag {
padding: 2px 5px 0;
margin-left: 3px;
vertical-align: middle;
@include govuk-font($size: 14, $weight: "bold");
}

.gem-c-environment-tag--production {
background-color: govuk-colour("bright-red");
}

.gem-c-environment-tag--development {
background-color: govuk-colour("grey-1");
}

.gem-c-environment-tag--staging,
.gem-c-environment-tag--integration {
background-color: govuk-colour("yellow");
color: govuk-colour("black");
}
@@ -1,5 +1,4 @@
<%
product_name ||= false
navigation_items ||= []
%>
<header class="gem-c-layout-header govuk-header gem-c-layout-header--<%= environment %>" role="banner" data-module="header">
Expand All @@ -18,12 +17,16 @@
GOV.UK
</span>
</span>
<% if product_name %>

<span class="govuk-header__product-name">
<%= product_name %>
Publishing
</span>

<span class="gem-c-environment-tag govuk-tag gem-c-environment-tag--<%= environment %>">
<%= environment %>
</span>
<% end %>
</a>

</div><div class="govuk-header__content">

<% if navigation_items.any? %>
Expand Down
Expand Up @@ -19,10 +19,6 @@ examples:
development_environment:
data:
environment: development
with_product_name:
data:
environment: production
product_name: Product
with_navigation:
data:
environment: production
Expand Down
6 changes: 0 additions & 6 deletions spec/components/layout_header_spec.rb
Expand Up @@ -17,12 +17,6 @@ def component_name
assert_select ".govuk-header.gem-c-layout-header--staging"
end

it "renders the product name" do
render_component(environment: "staging", product_name: "Product name")

assert_select ".govuk-header__product-name", text: "Product name"
end

it "renders the header with navigation items" do
navigation_items = [
{ text: "Foo", href: "/foo", active: true },
Expand Down
3 changes: 1 addition & 2 deletions spec/dummy/app/views/layouts/dummy_admin_layout.html.erb
@@ -1,4 +1,4 @@
<% environment = "production" %>
<% environment = %w[development production staging integration].sample %>
<%= render 'govuk_publishing_components/components/layout_for_admin', {
environment: environment,
Expand All @@ -7,7 +7,6 @@
<%= render "govuk_publishing_components/components/skip_link" %>
<%= render "govuk_publishing_components/components/layout_header", {
environment: environment,
product_name: "Admin",
navigation_items: [
{text: "John Doe", href: "#profile"},
{text: "Log out", href: "#logout"}
Expand Down

0 comments on commit 96129e1

Please sign in to comment.