diff --git a/packages/ffe-spinner-react/src/Spinner.js b/packages/ffe-spinner-react/src/Spinner.js index f2fbd8abd7..4b0eca236c 100644 --- a/packages/ffe-spinner-react/src/Spinner.js +++ b/packages/ffe-spinner-react/src/Spinner.js @@ -1,8 +1,16 @@ import React from 'react'; -import { bool, string, node } from 'prop-types'; +import { bool, string, node, oneOf } from 'prop-types'; import classNames from 'classnames'; +import texts from './texts'; -const Spinner = ({ className, immediate, large, loadingText, ...rest }) => ( +const Spinner = ({ + className, + immediate, + large, + loadingText, + locale, + ...rest +}) => (
( { 'ffe-loading-spinner--large': large }, )} role="img" - aria-label="Vennligst vent" + aria-label={texts[locale].ariaLabel} aria-hidden={!!loadingText} /> {loadingText} @@ -23,11 +31,14 @@ Spinner.propTypes = { immediate: bool, large: bool, loadingText: node, + /** 'nb', 'nn', or 'en' */ + locale: oneOf(['en', 'nb', 'nn']), }; Spinner.defaultProps = { immediate: false, large: false, + locale: 'nb', }; export default Spinner; diff --git a/packages/ffe-spinner-react/src/index.d.ts b/packages/ffe-spinner-react/src/index.d.ts index 62efcc8ba2..4395b0ce65 100644 --- a/packages/ffe-spinner-react/src/index.d.ts +++ b/packages/ffe-spinner-react/src/index.d.ts @@ -5,6 +5,7 @@ export interface SpinnerProps extends React.ComponentProps<'span'> { immediate?: boolean; large?: boolean; loadingText: React.ReactNode; + locale?: 'en' | 'nb' | 'nn'; } declare class Spinner extends React.Component {} diff --git a/packages/ffe-spinner-react/src/texts.js b/packages/ffe-spinner-react/src/texts.js new file mode 100644 index 0000000000..998f0e3d81 --- /dev/null +++ b/packages/ffe-spinner-react/src/texts.js @@ -0,0 +1,11 @@ +const nb = { + ariaLabel: 'Vennligst vent', +}; +const nn = { + ariaLabel: 'Ver vennleg og vent', +}; +const en = { + ariaLabel: 'Please wait', +}; + +export default { nb, nn, en };