Skip to content

Commit

Permalink
Merge pull request #1814 from alphagov/solid-secondary
Browse files Browse the repository at this point in the history
Add support for secondary solid buttons
  • Loading branch information
DilwoarH authored Dec 9, 2020
2 parents 232e851 + ccf4eca commit 5510418
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
useful summary for people upgrading their application, not a replication
of the commit log.

## Unreleased

* Add support for secondary solid buttons ([PR #1814](https://github.com/alphagov/govuk_publishing_components/pull/1814))

## 23.8.0

* Add password reveal component ([PR #1794](https://github.com/alphagov/govuk_publishing_components/pull/1794))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ examples:
data:
text: "Secondary quiet button"
secondary_quiet: true
secondary_solid_button:
data:
text: "Secondary solid button"
secondary_solid: true
destructive_button:
data:
text: "Destructive button"
Expand Down
3 changes: 3 additions & 0 deletions lib/govuk_publishing_components/presenters/button_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ButtonHelper
:start,
:secondary,
:secondary_quiet,
:secondary_solid,
:destructive,
:name,
:value,
Expand All @@ -41,6 +42,7 @@ def initialize(local_assigns)
@start = local_assigns[:start]
@secondary = local_assigns[:secondary]
@secondary_quiet = local_assigns[:secondary_quiet]
@secondary_solid = local_assigns[:secondary_solid]
@destructive = local_assigns[:destructive]
@name = local_assigns[:name]
@value = local_assigns[:value]
Expand Down Expand Up @@ -77,6 +79,7 @@ def css_classes
css_classes << "govuk-button--start" if start
css_classes << "gem-c-button--secondary" if secondary
css_classes << "gem-c-button--secondary-quiet" if secondary_quiet
css_classes << "govuk-button--secondary" if secondary_solid
css_classes << "govuk-button--warning" if destructive
css_classes << "gem-c-button--bottom-margin" if margin_bottom && !info_text
css_classes << "gem-c-button--inline" if inline_layout
Expand Down
6 changes: 6 additions & 0 deletions spec/components/button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ def component_name
assert_select ".gem-c-button--secondary-quiet"
end

it "renders secondary solid button" do
render_component(text: "Secondary solid", href: "#", secondary_solid: true)
assert_select ".govuk-button--secondary[href='#']", text: "Secondary solid"
assert_select ".govuk-button--secondary"
end

it "renders destructive button" do
render_component(text: "Warning", href: "#", destructive: true)
assert_select ".govuk-button--warning[href='#']", text: "Warning"
Expand Down

0 comments on commit 5510418

Please sign in to comment.