diff --git a/packages/ffe-context-message-react/src/ContextErrorMessage.js b/packages/ffe-context-message-react/src/ContextErrorMessage.js index 4e0d9893ea..4977bb545d 100644 --- a/packages/ffe-context-message-react/src/ContextErrorMessage.js +++ b/packages/ffe-context-message-react/src/ContextErrorMessage.js @@ -1,11 +1,12 @@ import React from 'react'; import { number, node, string, bool, oneOf, func, object } from 'prop-types'; import acceptedLocales from './locale/accepted-locales'; +import texts from './locale/texts'; import ContextMessage from './ContextMessage'; import { ContextMessageIcon } from './ContextMessageIcon'; const ContextErrorMessage = props => { - const { alert, ...rest } = props; + const { alert, locale, ...rest } = props; const priorityHighIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+'; @@ -16,14 +17,14 @@ const ContextErrorMessage = props => { return ( } /> @@ -43,7 +44,7 @@ ContextErrorMessage.propTypes = { header: string, /** ID for the header container */ headerElementId: string, - /** Decides the language of the aria-label for the close icon */ + /** Decides the language */ locale: oneOf(acceptedLocales), /** Callback for when the context message has been closed (after the animation) */ onClose: func, diff --git a/packages/ffe-context-message-react/src/ContextInfoMessage.js b/packages/ffe-context-message-react/src/ContextInfoMessage.js index f768fbc672..951baf64b0 100644 --- a/packages/ffe-context-message-react/src/ContextInfoMessage.js +++ b/packages/ffe-context-message-react/src/ContextInfoMessage.js @@ -1,8 +1,11 @@ import React from 'react'; import ContextMessage from './ContextMessage'; import { ContextMessageIcon } from './ContextMessageIcon'; +import texts from './locale/texts'; +import { oneOf } from 'prop-types'; +import acceptedLocales from './locale/accepted-locales'; -const ContextInfoMessage = props => { +const ContextInfoMessage = ({ locale, ...rest }) => { const infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg=='; @@ -11,19 +14,28 @@ const ContextInfoMessage = props => { return ( } /> ); }; +ContextInfoMessage.defaultProps = { + locale: 'nb', +}; + +ContextInfoMessage.propTypes = { + /** Decides the language */ + locale: oneOf(acceptedLocales), +}; + export default ContextInfoMessage; diff --git a/packages/ffe-context-message-react/src/ContextMessage.js b/packages/ffe-context-message-react/src/ContextMessage.js index 5aa9b3c183..3b50be94aa 100644 --- a/packages/ffe-context-message-react/src/ContextMessage.js +++ b/packages/ffe-context-message-react/src/ContextMessage.js @@ -112,9 +112,7 @@ const ContextMessage = ({ {showCloseButton && (