diff --git a/app/components/app_card_component.rb b/app/components/app_card_component.rb index 72a4cb86f..0eb9989d7 100644 --- a/app/components/app_card_component.rb +++ b/app/components/app_card_component.rb @@ -28,11 +28,12 @@ class AppCardComponent < ViewComponent::Base renders_one :heading renders_one :description - def initialize(colour: nil, link_to: nil) + def initialize(colour: nil, link_to: nil, secondary: false) super @link_to = link_to @colour = colour + @secondary = secondary end private @@ -43,7 +44,8 @@ def card_classes "app-card", ("nhsuk-card--feature" if @colour.present?), ("app-card--#{@colour}" if @colour.present?), - ("nhsuk-card--clickable" if @link_to.present?) + ("nhsuk-card--clickable" if @link_to.present?), + ("nhsuk-card--secondary" if @secondary) ].compact.join(" ") end diff --git a/spec/components/app_card_component_spec.rb b/spec/components/app_card_component_spec.rb index 2a1056f4f..83f1a2d30 100644 --- a/spec/components/app_card_component_spec.rb +++ b/spec/components/app_card_component_spec.rb @@ -34,4 +34,10 @@ it { should have_css(".nhsuk-card--feature") } it { should have_css(".app-card--red") } end + + context "when secondary" do + before { render_inline(described_class.new(secondary: true)) } + + it { should have_css(".nhsuk-card--secondary") } + end end