Releases: x-govuk/govuk-components
Version 2.1.0
- Table support - can be built using arrays of arrays or with slots, see the guide for examples. Also available via the
#govuk_table
helper. #243 - Bump
view_component
to2.39.0
Version 2.0.1
- Fix a 'no template' error by moving the header navigation item rendering inside
#call
Version 2.0.0
This is a big release and many components have been rewritten to take advantage of new functionality in ViewComponent.
Huge, huge thanks to @cpjmcquillan and @paulrobertlloyd for their help in putting this release together and to @boardfish and @BroiSatse for helping solve problems along the way!
Changes to the library
- aim for parity with the official GOV.UK Nunjucks macros (@paulrobertlloyd)
- move from ViewComponent slots v1 to v2
- switch specs from Capybara to RSpec HTML Matchers
- deprecate the
#add_slot_name
(formerly#slot_name
) helpers, this syntax has been adopted by ViewComponent itself
in slots v2, so we no longer need to do it ourselves - make code meet (most of) the GOV.UK Rubocop 4.0.0 standards
- added
Component
to the end of each component's name (Accordion
toAccordionComponent
). This helps avoid repetition in some places, i.e.,Tabs#tabs
- link helpers wrap their original Rails counterparts more closely, they can be called with either a URL, path or Rails-style
action
andcontroller
arguments - there are now
#govuk_link_classes
and#govuk_button_classes
helpers you can use in conjunction with other Rails's other link helpers like#link_to_if
and#link_to_unless
- add support for GOV.UK Frontend 3.13.0
The changes were logged in #158 and links to the relevant PRs are listed. The work as a whole is detailed in the Version 2.0.0 GitHub project.
Changes
More changes have been made than would be sensible to list in a single changelog entry. Details on specific components can be found in #158 and upgrades to bring in line with their Nunjucks counterparts are listed in #202.
Upgrade guide
-
component names now match those listed in the GOV.UK Design System docs with
Component
on the end, so 'Notification banner' isGovukComponent::NotificationBannerComponent
. The helpers remain unchanged except:govuk_start_now_button
is nowgovuk_start_button
govuk_warning
is nowgovuk_warning_text
-
keyword argument names now match those in the Nunjucks originals, but here we use
snake_case
instead ofcamelCase
- in a summary list action you'd usevisually_hidden_text
instead of `visuallyHidd> -
any
_html
arguments in the original Nunjucks macros are now slots, we can pass in a block of HTML instead:<%= govuk_notification_banner do |nb| %> <% nb.title_html do %> <h3>Add something useful here!</h3> <% end %> <% nb.heading(text: 'Something excellent happened') %> <% end %>
-
slots are now called using their name directly,
component.slot(:slot_name, ...)
becomescomponent.slot_name(...)
-
check the examples page for sample code
Support
As always, if you run into any problems in upgrading, please raise an issue on GitHub or ask a question in #developers
on DfE Slack or #software-development
on cross-gov Slack.
Version 1.2.0
-
Fix a bug in the accordion component that prevented the correct segment from automatically opening when reloading the page, thanks @cpjmcquillan #153
-
More header improvements, thanks again @paulrobertlloyd #151
- Fixes trailing whitespace around the ‘Menu’ text. This space is most noticeable when hovering over the button when this space is underlined
- Fixes the menu button not showing or hiding the navigation menu
- Add a new
navigation_label
param. This matches thenavigationLabel
setting available in the design system component:Text for the
aria-label
attribute of the navigation. Defaults to "Navigation menu". - Changes how
menu_button_label
is applied, to match the correspondingmenuButtonLabel
setting used by the design system component (breaking change):Text for the
aria-label
attribute of the button that toggles the navigation. Defaults to "Show or hide navigation menu".
-
Improvements to contributing section of the README, again thanks @paulrobertlloyd #152
Version 1.1.9
Version 1.1.8
- Various header improvements. Thanks to @paulrobertlloyd for reporting these:
Version 1.1.7
- Improvements to the:
- panel component - now takes a block of HTML as an alternative to passing in
title
andcontent
#135 - inset text component - also takes a block of HTML so there's more flexibility than just passing in
text
#134 - header component - allows the
product_name
to be set and also allows a block of HTML viaproduct_description
#133 - phase banner component, which calls the
GovukComponent::Tag
to generate its tag giving users access to the full functionality of the tag (colours, etc) #136
- panel component - now takes a block of HTML as an alternative to passing in
Thanks to @paulrobertlloyd for the suggestions.
Version 1.1.6
- Add extra arguments to the breadcrumbs component to allow the following behaviours. Thanks to @paulrobertlloyd for requesting these.
Version 1.1.5
Version 1.1.4
- Upgrade
view_component
to 2.28 - it being pegged to=< 2.27
by Dependabot was holding people on the latest version back (DFE-Digital/apply-for-teacher-training/pull/4347) - thanks to @paulrobertlloyd for reporting