Skip to content

Commit

Permalink
GL-79: Upgrade GovUK Frontend libraries (#782)
Browse files Browse the repository at this point in the history
* GL-79: Upgrade GovUK Frontend libraries
  • Loading branch information
rasikasri committed May 8, 2024
1 parent d6bad7f commit 067e4a9
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 35 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ GEM
sentry-rails (~> 5.3)
sentry-ruby (~> 5.3)
statsd-ruby (~> 1.5)
govuk_design_system_formbuilder (4.1.1)
govuk_design_system_formbuilder (5.3.3)
actionview (>= 6.1)
activemodel (>= 6.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -221,7 +221,7 @@ GEM
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
mini_portile2 (2.8.6)
minitest (5.22.3)
msgpack (1.7.2)
multipart-post (2.3.0)
Expand All @@ -238,7 +238,7 @@ GEM
net-smtp (0.4.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.3)
nokogiri (1.16.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
opentelemetry-api (1.2.3)
Expand Down
41 changes: 21 additions & 20 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,39 @@
<%= tag :meta, name: 'theme-color', content: '#0b0c0c' %>
<%= tag :meta, name: 'robots', content: 'noindex,nofollow' %>
<%= render partial: 'layouts/google_tag_manager' %>
<%= favicon_link_tag asset_pack_path('media/images/favicon.ico') %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %>
<%= favicon_link_tag asset_pack_path('media/images/favicon.ico'), sizes: '48x48' %>
<%= favicon_link_tag asset_pack_path('media/images/favicon.svg'), sizes: 'any' %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-icon-mask.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %>
<%= favicon_link_tag asset_pack_path('media/images/govuk-icon-180.png'), rel: 'apple-touch-icon', type: 'image/png' %>
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload', media: 'all' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload', defer: true %>
</head>

<body class="govuk-template__body ">
<%= render partial: 'layouts/google_tag_manager_no_script' %>
<%= javascript_tag nonce: true do -%>
document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');
<% end -%>

<a href="#main-content" class="govuk-skip-link" data-module="govuk-skip-link">Skip to main content</a>

<header class="govuk-header" role="banner" data-module="govuk-header">
<div class="govuk-header__container govuk-width-container header-wrapper">
<header class="govuk-header" data-module="govuk-header">
<div class="govuk-header__container govuk-width-container">
<div class="govuk-header__logo">
<%= link_to "/", class: "govuk-header__link govuk-header__link--homepage" do %>
<span class="govuk-header__logotype">
<svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="32" width="36">
<path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2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-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
<image src="<%= asset_pack_path('media/images/govuk-logotype-crown.png') %>" class="govuk-header__logotype-crown-fallback-image"></image>
</svg>
<span class="govuk-header__logotype-text">
GOV.UK
</span>
</span>
<% end %>
<a href="#" class="govuk-header__link govuk-header__link--homepage">
<svg
focusable="false"
role="img"
class="govuk-header__logotype"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 148 30"
height="30"
width="148"
aria-label="GOV.UK">
<title>GOV.UK</title>
<path d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.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-4.2V7zm-27.6 16.1c-1.5 0-2.7 1.2-2.7 2.7s1.2 2.7 2.7 2.7 2.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z"></path>
</svg>
</a>
</div>
<%= render 'navbar/main' %>
</div>
Expand Down
6 changes: 4 additions & 2 deletions app/views/navbar/_main.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<div class="govuk-header__content">
<a href="<%= sections_url %>" class="govuk-header__link govuk-header__link--service-name" id="proposition-name">
<a href="<%= sections_url %>" class="govuk-header__link govuk-header__service-name" id="proposition-name">
<%= header %>
</a>
<nav id="proposition-menu" class="govuk-header__navigation" aria-label="Top Level Navigation">
<button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="proposition-links" aria-label="Show or hide Top Level Navigation">Menu</button>
<button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="proposition-links" hidden>
Menu
</button>
<ul id="proposition-links" class="govuk-header__navigation-list">
<li class="govuk-header__navigation-item">
<%= link_to 'Search', search_url, class: "govuk-header__link" %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="govuk-warning-text">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<strong class="govuk-warning-text__text">
<span class="govuk-warning-text__assistive">Information</span>
<span class="govuk-visually-hidden">Information</span>
<%= @duty_options.third_country_tariff_option.warning_text %>
</strong>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/webpacker/packs/application.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require.context('govuk-frontend/govuk/assets');
require.context('govuk-frontend/dist/govuk/assets');

import '../styles/application.scss';
import Rails from 'rails-ujs';
import { initAll } from 'govuk-frontend';
import { initAll } from 'govuk-frontend/dist/govuk/govuk-frontend.min.js';

Rails.start();
initAll();
2 changes: 1 addition & 1 deletion app/webpacker/styles/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $govuk-font-url-function: frontend-font-url;
$govuk-image-url-function: frontend-image-url;
$govuk-global-styles: true;

@import "~govuk-frontend/govuk/all";
@import "~govuk-frontend/dist/govuk/all";
@import "accessible-autocomplete";
@import "custom";
@import "autocomplete";
Expand Down
2 changes: 1 addition & 1 deletion config/webpacker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default: &default

# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
additional_paths: ['node_modules/govuk-frontend/govuk']
additional_paths: ['node_modules/govuk-frontend/dist/govuk']

# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": {
"@rails/webpacker": "^5.4.4",
"accessible-autocomplete": "^2.0.4",
"govuk-frontend": "^4.7.0",
"govuk-frontend": "5.3.1",
"rails-ujs": "^5.2.8",
"serialize-javascript": "^6.0.2",
"set-value": "^4.1.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3033,10 +3033,10 @@ gopd@^1.0.1:
dependencies:
get-intrinsic "^1.1.3"

govuk-frontend@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-4.7.0.tgz#69950b6c2e69f435ffe9aa60d8dee232dac977de"
integrity sha512-0OsdCusF5qvLWwKziU8zqxiC0nq6WP0ZQuw51ymZ/1V0tO71oIKMlSLN2S9bm8RcEGSoidPt2A34gKxePrLjvg==
govuk-frontend@5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-5.3.1.tgz#d63e2078b0d94a119bfe322431218f04024668a2"
integrity sha512-EzegdVdmZVwXUGTQTsBgK4TkMpMyPdOIa2g1kvwX7EeyP9Kah+amXSo97gbiI8N49L6E0J6/2H6qLW4QN3KhMQ==

graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2:
version "4.2.11"
Expand Down

0 comments on commit 067e4a9

Please sign in to comment.