Skip to content

Releases: x-govuk/govuk-components

Version 2.0.0

18 Aug 14:11
3815d63
Compare
Choose a tag to compare

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 to AccordionComponent). 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 and controller 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' is GovukComponent::NotificationBannerComponent. The helpers remain unchanged except:

    • govuk_start_now_button is now govuk_start_button
    • govuk_warning is now govuk_warning_text
  • keyword argument names now match those in the Nunjucks originals, but here we use snake_case instead of camelCase - in a summary list action you'd use visually_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, ...) becomes component.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

09 May 11:28
aea56cd
Compare
Choose a tag to compare
  • 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 the navigationLabel 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 corresponding menuButtonLabel 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

28 Apr 17:11
89a8d90
Compare
Choose a tag to compare
  • Resolve with_content_areas deprecation warning in the cookie banner component. Thanks @despo for this, #147

Version 1.1.8

24 Apr 13:48
d9f7485
Compare
Choose a tag to compare
  • Various header improvements. Thanks to @paulrobertlloyd for reporting these:
    • Ensure button to expand mobile menu is present #132
    • Move the product name and description inside the link #140
    • Add the ability to set custom classes on the nav list #141
    • Allow linkless nav items to be created #142

Version 1.1.7

12 Apr 10:34
2181362
Compare
Choose a tag to compare
  • Improvements to the:
    • panel component - now takes a block of HTML as an alternative to passing in title and content #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 via product_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

Thanks to @paulrobertlloyd for the suggestions.

Version 1.1.6

26 Mar 09:29
0a24e3c
Compare
Choose a tag to compare
  • Add extra arguments to the breadcrumbs component to allow the following behaviours. Thanks to @paulrobertlloyd for requesting these.
    • the breadcrumbs to be suppressed when printing #126
    • the breadcrumbs to be collapsed on mobile #125

Version 1.1.5

25 Mar 11:35
bc65cff
Compare
Choose a tag to compare
  • Remove rails as a dependency due to mimemagic licence drama. Many thanks to @asmega for contributing this fix #124

Version 1.1.4

23 Mar 11:30
1066064
Compare
Choose a tag to compare

Version 1.1.3

11 Mar 12:00
bfea496
Compare
Choose a tag to compare
  • Make the notification banner render if there's content passed in (via a block) even when there are no headings provided. This makes the component generally more flexible but still allows it to be used without having to wrap it with a <% if notifications.any? %> block. Thanks to @fofr for raising this. #120

Version 1.1.2

02 Mar 14:33
031594a
Compare
Choose a tag to compare