Skip to content

Commit

Permalink
Merge pull request #1142 from alphagov/title-component-margin
Browse files Browse the repository at this point in the history
Implement customisable spacing for title component
  • Loading branch information
andysellick authored Sep 14, 2017
2 parents 04f6f7f + b1a903d commit 29aa8b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 8 additions & 1 deletion app/assets/stylesheets/govuk-component/_title.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// scss-lint:disable SelectorFormat
.pub-c-title {
@include responsive-vertical-margins;
@include responsive-top-margin;
}

// this will be moved and extended into a model for general component spacing
// once this has been decided upon and other work completed, see:
// https://trello.com/c/KEkNsxG3/142-3-implement-customisable-spacing-for-components
.pub-c-title--bottom-margin {
@include responsive-bottom-margin;
}

.pub-c-title--inverse {
Expand Down
7 changes: 4 additions & 3 deletions app/views/govuk_component/docs/title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ examples:
context: Publication
title: My page title which is often really long and verbose and has lots of extra words it doesn't need
average_title_length: long
title_on_dark_background:
description: Page titles with dark backgrounds are used in HTML Publications ([see example](https://www.gov.uk/government/publications/fees-for-civil-and-family-courts/court-fees-for-the-high-court-county-court-and-family-court))
in_html_publication:
description: Page titles are used in HTML Publications ([see example](https://www.gov.uk/government/publications/fees-for-civil-and-family-courts/court-fees-for-the-high-court-county-court-and-family-court))
data:
context: Publication
title: My inverse page title
title: HTML publication page title
inverse: true
margin_bottom: 0
context:
dark_background: true
6 changes: 5 additions & 1 deletion app/views/govuk_component/title.raw.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
average_title_length ||= false
context ||= false
inverse ||= false
margin_bottom ||= 1
margin_bottom_class = "pub-c-title--bottom-margin" if margin_bottom == 1
%>
<div class="pub-c-title <% if inverse %>pub-c-title--inverse<% end %>">
<div class="pub-c-title
<% if inverse %>pub-c-title--inverse<% end %>
<%= margin_bottom_class %>">
<% if context %>
<p class="pub-c-title__context"><%= context %></p>
<% end %>
Expand Down

0 comments on commit 29aa8b7

Please sign in to comment.