Retouche "de avril" → "d'avril"

pull/995/head
Maxime Quandalle 2020-04-24 11:10:44 +02:00
parent 3afb378ed6
commit c2249929c9
2 changed files with 9 additions and 4 deletions

View File

@ -10,6 +10,9 @@ const localStorageKey = 'last-viewed-release'
export const hideNewsBanner = () => writeStorage(localStorageKey, lastRelease)
export const determinant = (word: string) =>
word.match(/^[aeiouy]/i) ? 'd' : 'de '
export default function NewsBanner() {
const [lastViewedRelease] = useLocalStorage(localStorageKey)
const sitePaths = useContext(SitePathsContext)
@ -27,8 +30,8 @@ export default function NewsBanner() {
return showBanner ? (
<div className="ui__ banner news">
<span>
{emoji('✨')} Découvrez les nouveautés de{' '}
<Link to={sitePaths.nouveautés}>{lastRelease}</Link>
{emoji('✨')} Découvrez les nouveautés {determinant(lastRelease)}
<Link to={sitePaths.nouveautés}>{lastRelease.toLowerCase()}</Link>
</span>
<span onClick={hideNewsBanner} className="ui__ close-button">
&times;

View File

@ -8,7 +8,7 @@ import { Redirect, useHistory, useRouteMatch } from 'react-router'
import { Link, NavLink } from 'react-router-dom'
import styled from 'styled-components'
import useSWR from 'swr'
import { hideNewsBanner } from '../../layout/NewsBanner'
import { determinant, hideNewsBanner } from '../../layout/NewsBanner'
const fetcher = (url: RequestInfo) => fetch(url).then(r => r.json())
const slugify = (name: string) => name.toLowerCase().replace(' ', '-')
@ -42,6 +42,8 @@ export default function Nouveautés() {
return <Redirect to={getPath(0)} />
}
const releaseName = data[selectedRelease].name.toLowerCase()
return (
<>
<ScrollToTop key={selectedRelease} />
@ -51,7 +53,7 @@ export default function Nouveautés() {
les{' '}
{selectedRelease === 0
? 'dernières nouveautés'
: `nouveautés de ${data[selectedRelease].name.toLowerCase()}`}
: `nouveautés ${determinant(releaseName)}${releaseName}`}
&nbsp;:
</p>
<SmallScreenSelect