Skip to content

Commit

Permalink
Remove id from default attrs and improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
peteryates committed Mar 22, 2023
1 parent 211b6f6 commit b2e1928
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/components/govuk_component/accordion_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ class GovukComponent::AccordionComponent < GovukComponent::Base
html_attributes: html_attributes,
summary_text: summary_text,
heading_text: heading_text,
accordion_id: id,
accordion_id: accordion_id,
&block
)
end

attr_reader :id, :heading_level
attr_reader :accordion_id, :heading_level

def initialize(heading_level: 2, classes: [], html_attributes: {})
@heading_level = heading_tag(heading_level)
@id = html_attributes[:id]
@accordion_id = html_attributes[:id]

super(classes: classes, html_attributes: html_attributes)
end

private

def default_attributes
{ id: id, class: %w(govuk-accordion), data: { module: 'govuk-accordion' } }.compact
{ class: %w(govuk-accordion), data: { module: 'govuk-accordion' } }.compact
end

def heading_tag(level)
Expand Down

0 comments on commit b2e1928

Please sign in to comment.