Skip to content

Commit

Permalink
Merge pull request #222 from alphagov/add-margin-flag-feedback-component
Browse files Browse the repository at this point in the history
Add margin_top flag to feedback component
  • Loading branch information
Vanita Barrett committed Mar 15, 2018
2 parents a90789b + 25ecf4d commit 477ffd2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

* Add optional margin top flag for feedback component (PR #222)

# 5.5.5
* Add optional flags for spacing around document list component (PR #217)

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
govuk_publishing_components (5.5.2)
govuk_publishing_components (5.5.5)
govspeak (>= 5.0.3)
govuk_frontend_toolkit
rails (>= 5.0.0.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
.gem-c-feedback {
max-width: 960px;
margin: 0 auto;
}

.gem-c-feedback--top-margin {
margin-top: $gutter;

@include media(tablet) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<%
contact_govuk_path = "/contact/govuk"
margin_top ||= 1
margin_top_class = "gem-c-feedback--top-margin" if margin_top == 1
%>

<div class="gem-c-feedback" data-module="feedback">
<div class="gem-c-feedback <%= margin_top_class %>" data-module="feedback">
<div class="gem-c-feedback__prompt gem-c-feedback__js-show js-prompt" tabindex="-1">
<div class="js-prompt-questions">
<h3 class="gem-c-feedback__prompt-question">Is this page useful?</h3>
Expand Down
6 changes: 6 additions & 0 deletions spec/components/feedback_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ def component_name

assert_select ".gem-c-feedback .gem-c-feedback__prompt-link--wrong[href='/contact/govuk']", text: 'Is there anything wrong with this page?'
end

it "removes top margin when margin_top flag is set" do
render_component(margin_top: 0)

assert_select ".gem-c-feedback.gem-c-feedback--margin-top", false
end
end

0 comments on commit 477ffd2

Please sign in to comment.