-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from City-of-Helsinki/HP-2047-new-hds-into-use
HP-2047 New HDS into use
- Loading branch information
Showing
37 changed files
with
1,207 additions
and
561 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 |
---|---|---|
|
@@ -25,3 +25,5 @@ npm-debug.log* | |
yarn-debug.log* | ||
yarn-error.log* | ||
.eslintcache | ||
.idea/ | ||
.vscode/ |
This file was deleted.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,69 +1,85 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Footer as HDSFooter, IconLinkExternal } from 'hds-react'; | ||
import { Footer as HDSFooter, Logo, logoFiDark, logoSvDark } from 'hds-react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import styles from './Footer.module.css'; | ||
import getLanguageCode from '../helpers/getLanguageCode'; | ||
import config from '../../config'; | ||
|
||
function Footer(): React.ReactElement { | ||
const Footer = () => { | ||
const { t, i18n } = useTranslation(); | ||
const lang = getLanguageCode(i18n.languages[0]); | ||
const logoLanguage = lang === 'sv' ? 'sv' : 'fi'; | ||
const logoSrcFromLanguage = lang === 'sv' ? logoSvDark : logoFiDark; | ||
|
||
const createAriaLabel = (title: string) => { | ||
const titleWithoutLastDot = | ||
title.slice(-1) === '.' ? title.substr(0, title.length - 1) : title; | ||
title.slice(-1) === '.' ? title.substring(0, title.length - 1) : title; | ||
return t('opensInNewWindow', { | ||
title: titleWithoutLastDot, | ||
}); | ||
}; | ||
|
||
const whiteColor = 'var(--color-white)'; | ||
|
||
return ( | ||
<HDSFooter theme="dark" title={t('appName')} logoLanguage={logoLanguage}> | ||
<HDSFooter.Utilities backToTopLabel={t('footer.backToTop')}> | ||
<HDSFooter.Item | ||
<HDSFooter | ||
theme={{ | ||
'--footer-background': 'var(--color-bus)', | ||
'--footer-color': whiteColor, | ||
'--footer-divider-color': whiteColor, | ||
'--footer-focus-outline-color': whiteColor, | ||
}} | ||
title={t('appName')} | ||
> | ||
<HDSFooter.Utilities> | ||
<HDSFooter.Link | ||
aria-label={createAriaLabel(t('footer.contactUs'))} | ||
external | ||
href={t('footer.contactUsLink')} | ||
label={t('footer.contactUs')} | ||
aria-label={createAriaLabel(t('footer.contactUs'))} | ||
className={styles['link-with-icon']} | ||
target="_blank" | ||
> | ||
<IconLinkExternal aria-hidden size={'s'} /> | ||
</HDSFooter.Item> | ||
<HDSFooter.Item | ||
/> | ||
<HDSFooter.Link | ||
aria-label={createAriaLabel(t('footer.feedback'))} | ||
external | ||
href={t('footer.feedbackLink')} | ||
label={t('footer.feedback')} | ||
aria-label={createAriaLabel(t('footer.feedback'))} | ||
className={styles['link-with-icon']} | ||
target="_blank" | ||
> | ||
<IconLinkExternal aria-hidden size={'s'} /> | ||
</HDSFooter.Item> | ||
/> | ||
</HDSFooter.Utilities> | ||
<HDSFooter.Base | ||
copyrightHolder={t('cityOfHelsinki')} | ||
copyrightText={t('footer.reserveRights')} | ||
backToTopLabel={t('footer.backToTop')} | ||
logo={ | ||
<Logo | ||
src={logoSrcFromLanguage} | ||
size="medium" | ||
alt="Helsingin kaupunki" | ||
/> | ||
} | ||
logoHref="https://hel.fi" | ||
> | ||
<HDSFooter.Item | ||
<HDSFooter.Link | ||
aria-label={createAriaLabel(t('footer.privacy'))} | ||
external | ||
href={t('profileForm.termsFileDescriptionLink')} | ||
label={t('footer.privacy')} | ||
aria-label={createAriaLabel(t('footer.privacy'))} | ||
className={styles['base-link-with-icon']} | ||
target="_blank" | ||
> | ||
<IconLinkExternal aria-hidden size={'xs'} /> | ||
</HDSFooter.Item> | ||
<HDSFooter.Item as={Link} to="/accessibility"> | ||
{t('footer.accessibility')} | ||
</HDSFooter.Item> | ||
<HDSFooter.Item as={Link} to={config.cookiePagePath}> | ||
{t('cookies.pageName')} | ||
</HDSFooter.Item> | ||
/> | ||
<HDSFooter.Link | ||
as={Link} | ||
to="/accessibility" | ||
label={t('footer.accessibility')} | ||
/> | ||
<HDSFooter.Link | ||
as={Link} | ||
to={config.cookiePagePath} | ||
label={t('cookies.pageName')} | ||
/> | ||
</HDSFooter.Base> | ||
</HDSFooter> | ||
); | ||
} | ||
}; | ||
|
||
export default Footer; |
Oops, something went wrong.