Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs component #42

Merged
merged 4 commits into from
Aug 19, 2020
Merged

Tabs component #42

merged 4 commits into from
Aug 19, 2020

Conversation

peteryates
Copy link
Member

@peteryates peteryates commented Aug 18, 2020

Add a tabs component using the new Slots API. The ViewComponent Slot API is the experimental replacement for
ContentArea. It offers far more power and lets us repeat (via collection) calls to slots, so we can define an unlimited number of tabs with a clean DSL-like syntax.

The main bonus here, and the cause of the delay on this work, is that now testing block functionality is fully supported by render_inline taking a block.

render GovukComponent::Tabs.new(title: 'Days of the week') do |component|
  component.slot(:tab, title: 'Monday') do
    tag.p("Monday's child is fair of face", class: 'govuk-body')
  end

  component.slot(:tab, title: 'Tuesday') do
    tag.p("Tuesday's child is full of grace", class: 'govuk-body')
  end

  component.slot(:tab, title: 'Wednesday') do
    tag.p("Wednesday's child is full of woe", class: 'govuk-body')
  end
end

Screenshot from 2020-08-18 23-43-30

The ViewComponent Slot API is the experimental replacement for
ContentArea. It offers *far* more power and lets us repeat (via
`collection`) calls to slots, so we can define an unlimited number of
tabs with a clean DSL-like syntax.

The main bonus here, and the cause of the delay on this work, is that
now testing block functionality is fully supported by `render_inline`
taking a block.
The main offender was the missing `js-enabled` on body.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant