diff --git a/.npmrc b/.npmrc index fa3ae812..38f23097 100644 --- a/.npmrc +++ b/.npmrc @@ -1,4 +1,4 @@ -@ukhomeoffice:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} - +@asl:registry = https://artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/ +//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:username=${NPM_AUTH_USERNAME} +//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:_password=${NPM_AUTH_TOKEN} \ No newline at end of file diff --git a/package.json b/package.json index c29d2155..f74eb020 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@ukhomeoffice/components", + "name": "@asl/components", "version": "11.0.0", "description": "React components for ASL layouts and elements", "main": "src/index.jsx", @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/ukhomeoffice/asl-components#readme", "publishConfig": { - "@ukhomeoffice:registry": "https://npm.pkg.github.com" + "registry": "https://artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/" }, "dependencies": { "@ukhomeoffice/asl-constants": "^2.0.0", diff --git a/src/datatable/index.jsx b/src/datatable/index.jsx index 1c602408..fc6e0f78 100644 --- a/src/datatable/index.jsx +++ b/src/datatable/index.jsx @@ -8,6 +8,7 @@ import pickBy from 'lodash/pickBy'; import { getValue } from '../utils'; import DatatableHeader from './header'; import { Pagination } from '../'; +import { LoadingSpinner } from '../loading-spinner'; export function Row({ row, schema, Expandable, Actions, expands, alwaysExpanded }) { const rowExpands = expands(row); @@ -108,6 +109,9 @@ export function Datatable({ + { + isFetching &&
+ } { data.length === 0 && noDataWarning && {noDataWarning} } diff --git a/src/datatable/index.scss b/src/datatable/index.scss index 4627a73f..71a85e85 100644 --- a/src/datatable/index.scss +++ b/src/datatable/index.scss @@ -98,4 +98,20 @@ } } } + + tbody { + position: relative; + + .loading-overlay { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + display: flex; + align-items: center; + justify-content: center; + background: rgba(255, 255, 255, 0.7); + } + } } diff --git a/src/index.jsx b/src/index.jsx index b58d8d48..6808981f 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -41,6 +41,7 @@ export { default as LicenceStatusBanner } from './licence-status-banner'; export { default as Link } from './link'; export { default as LinkFilter } from './link-filter'; export { default as LinkFilterList } from './link-filter-list'; +export { default as LoadingSpinner } from './loading-spinner'; export { default as Markdown } from './markdown'; export { default as ModelSummary } from './model-summary'; export { default as Metric } from './metric'; diff --git a/src/loading-spinner/index.jsx b/src/loading-spinner/index.jsx new file mode 100644 index 00000000..aa9bfa24 --- /dev/null +++ b/src/loading-spinner/index.jsx @@ -0,0 +1,6 @@ +import classNames from 'classnames'; +import React from 'react'; + +export function LoadingSpinner({ small = false }) { + return
; +} diff --git a/src/loading-spinner/index.scss b/src/loading-spinner/index.scss new file mode 100644 index 00000000..416384f9 --- /dev/null +++ b/src/loading-spinner/index.scss @@ -0,0 +1,31 @@ +.govuk-spinner { + border: 12px solid #dee0e2; + border-radius: 50%; + border-top-color: #005ea5; + width: 80px; + height: 80px; + -webkit-animation: spin 2s linear infinite; + animation: spin 2s linear infinite; + + &.small { + width: 40px; + height: 40px; + border-width: 6px; + } +} +@-webkit-keyframes spin { + 0% { + -webkit-transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + } +} +@keyframes spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} diff --git a/styles/index.scss b/styles/index.scss index e345aae5..b726b324 100644 --- a/styles/index.scss +++ b/styles/index.scss @@ -26,6 +26,7 @@ $highlight-colour: govuk-colour('grey-4'); @import '../src/header/index'; @import '../src/link-filter/index'; @import '../src/link-filter-list/index'; +@import '../src/loading-spinner/index'; @import '../src/metric/index'; @import '../src/model-summary/index'; @import '../src/multi-input/index';