Import / require all code for the govuk frontend button

This commit is contained in:
Katie Smith
2020-01-29 14:07:40 +00:00
parent 97d6855ff7
commit 66967e1d96
2 changed files with 7 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
// For example, `export { Frontend }` will assign `Frontend` to `window.Frontend`
import Header from 'govuk-frontend/components/header/header';
import Details from 'govuk-frontend/components/details/details';
import Button from 'govuk-frontend/components/button/button';
/**
* TODO: Ideally this would be a NodeList.prototype.forEach polyfill
@@ -33,6 +34,9 @@ function initAll (options) {
// Defaults to the entire document if nothing is set.
var scope = typeof options.scope !== 'undefined' ? options.scope : document
// Find all buttons with [role=button] on the scope to enhance.
new Button(scope).init()
// Find all global details elements to enhance.
var $details = scope.querySelectorAll('details')
nodeListForEach($details, function ($detail) {
@@ -48,6 +52,7 @@ function initAll (options) {
var Frontend = {
"Header": Header,
"Details": Details,
"Button": Button,
"initAll": initAll
}

View File

@@ -64,7 +64,8 @@ const copy = {
'header',
'footer',
'back-link',
'details'
'details',
'button'
];
let done = 0;