-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AKR:YKI(Frontend): Take new CookieBanner and LangSelector into use [d…
…eploy]
- Loading branch information
Showing
15 changed files
with
176 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,6 @@ | |
"akr:tslint": "yarn g:tsc --pretty --noEmit" | ||
}, | ||
"dependencies": { | ||
"shared": "npm:@opetushallitus/[email protected].0" | ||
"shared": "npm:@opetushallitus/[email protected].2" | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
frontend/packages/akr/src/components/common/AkrLangSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { LangSelector } from 'shared/components'; | ||
import { AppLanguage } from 'shared/enums'; | ||
|
||
import { | ||
changeLang, | ||
getCurrentLang, | ||
getSupportedLangs, | ||
useAppTranslation, | ||
} from 'configs/i18n'; | ||
|
||
export const AkrLangSelector = ({ usage }: { usage: 'dialog' | 'header' }) => { | ||
const { t } = useAppTranslation({ | ||
keyPrefix: 'akr.component.header', | ||
}); | ||
const [finnish, swedish, english] = getSupportedLangs(); | ||
|
||
const langDict = new Map<string, AppLanguage>([ | ||
[t('lang.fi'), finnish], | ||
[t('lang.sv'), swedish], | ||
[t('lang.en'), english], | ||
]); | ||
|
||
return ( | ||
<LangSelector | ||
usage={usage} | ||
changeLang={changeLang} | ||
getCurrentLang={getCurrentLang} | ||
langDict={langDict} | ||
langSelectorAriaLabel={t('accessibility.langSelectorAriaLabel')} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
"yki:tslint": "yarn g:tsc --pretty --noEmit" | ||
}, | ||
"dependencies": { | ||
"shared": "npm:@opetushallitus/[email protected].0" | ||
"shared": "npm:@opetushallitus/[email protected].2" | ||
}, | ||
"devDependencies": { | ||
"multer": "^1.4.5-lts.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,18 @@ | |
} | ||
}, | ||
"contactEmail": "[email protected]", | ||
"cookieBanner": { | ||
"acceptButton": { | ||
"ariaLabel": "Accept cookies", | ||
"label": "Accept" | ||
}, | ||
"description": "This web site uses mandatory cookies to be functional.", | ||
"readMoreLink": { | ||
"href": "https://TODO.FIXME", | ||
"label": "Read more about cookies." | ||
}, | ||
"title": "Accept cookies" | ||
}, | ||
"dates": { | ||
"dateTimeFormat": "l [at] HH:mm" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,18 @@ | |
} | ||
}, | ||
"contactEmail": "[email protected]", | ||
"cookieBanner": { | ||
"acceptButton": { | ||
"ariaLabel": "Hyväksy evästeet", | ||
"label": "Hyväksy" | ||
}, | ||
"description": "Tämä sivusto käyttää välttämättömiä evästeitä toimiakseen.", | ||
"readMoreLink": { | ||
"href": "https://TODO.FIXME", | ||
"label": "Lue lisätietoa evästeistä." | ||
}, | ||
"title": "Hyväksy evästeet" | ||
}, | ||
"dates": { | ||
"dateTimeFormat": "l [klo] HH.mm" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,18 @@ | |
} | ||
}, | ||
"contactEmail": "[email protected]", | ||
"cookieBanner": { | ||
"acceptButton": { | ||
"ariaLabel": "Acceptera cookies", | ||
"label": "Acceptera" | ||
}, | ||
"description": "Den här webbplatsen använder nödvändiga cookies för att fungera.", | ||
"readMoreLink": { | ||
"href": "https://TODO.FIXME", | ||
"label": "Läs mer om cookies." | ||
}, | ||
"title": "Acceptera cookies" | ||
}, | ||
"dates": { | ||
"dateTimeFormat": "l [kl.] HH:mm" | ||
}, | ||
|
32 changes: 32 additions & 0 deletions
32
frontend/packages/yki/src/components/elements/YkiLangSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { LangSelector } from 'shared/components'; | ||
import { AppLanguage } from 'shared/enums'; | ||
|
||
import { | ||
changeLang, | ||
getCurrentLang, | ||
getSupportedLangs, | ||
useCommonTranslation, | ||
} from 'configs/i18n'; | ||
|
||
export const YkiLangSelector = ({ usage }: { usage: 'dialog' | 'header' }) => { | ||
const translateCommon = useCommonTranslation(); | ||
const [finnish, swedish, english] = getSupportedLangs(); | ||
|
||
const langDict = new Map<string, AppLanguage>([ | ||
[translateCommon('header.lang.fi'), finnish], | ||
[translateCommon('header.lang.sv'), swedish], | ||
[translateCommon('header.lang.en'), english], | ||
]); | ||
|
||
return ( | ||
<LangSelector | ||
usage={usage} | ||
changeLang={changeLang} | ||
getCurrentLang={getCurrentLang} | ||
langDict={langDict} | ||
langSelectorAriaLabel={translateCommon( | ||
'header.accessibility.langSelectorAriaLabel' | ||
)} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 25 additions & 5 deletions
30
frontend/packages/yki/src/tests/cypress/support/commands.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.