mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 08:29:49 -04:00
Import / require all code for the govuk frontend button
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
// For example, `export { Frontend }` will assign `Frontend` to `window.Frontend`
|
// For example, `export { Frontend }` will assign `Frontend` to `window.Frontend`
|
||||||
import Header from 'govuk-frontend/components/header/header';
|
import Header from 'govuk-frontend/components/header/header';
|
||||||
import Details from 'govuk-frontend/components/details/details';
|
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
|
* 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.
|
// Defaults to the entire document if nothing is set.
|
||||||
var scope = typeof options.scope !== 'undefined' ? options.scope : document
|
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.
|
// Find all global details elements to enhance.
|
||||||
var $details = scope.querySelectorAll('details')
|
var $details = scope.querySelectorAll('details')
|
||||||
nodeListForEach($details, function ($detail) {
|
nodeListForEach($details, function ($detail) {
|
||||||
@@ -48,6 +52,7 @@ function initAll (options) {
|
|||||||
var Frontend = {
|
var Frontend = {
|
||||||
"Header": Header,
|
"Header": Header,
|
||||||
"Details": Details,
|
"Details": Details,
|
||||||
|
"Button": Button,
|
||||||
"initAll": initAll
|
"initAll": initAll
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ const copy = {
|
|||||||
'header',
|
'header',
|
||||||
'footer',
|
'footer',
|
||||||
'back-link',
|
'back-link',
|
||||||
'details'
|
'details',
|
||||||
|
'button'
|
||||||
];
|
];
|
||||||
let done = 0;
|
let done = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user