Ajoute une animation pour l'apparition des notifications

pull/2101/head
Johan Girod 2022-04-21 11:25:02 +02:00
parent 4078113674
commit 461a1b2e2f
1 changed files with 23 additions and 20 deletions

View File

@ -10,6 +10,7 @@ import { Trans, useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import styled from 'styled-components'
import RuleLink from './RuleLink'
import { Appear } from './ui/animate'
import { Markdown } from './utils/markdown'
// To add a new notification to a simulator, you should create a publicodes rule
@ -67,27 +68,29 @@ export default function Notifications() {
margin-top: 1rem;
`}
>
{messages.map(({ sévérité, dottedName, résumé, description }) => (
<Message
icon
type={sévérité === 'avertissement' ? 'info' : 'primary'}
key={dottedName}
>
<Markdown>{résumé ?? description ?? ''}</Markdown>{' '}
{résumé && (
<RuleLink dottedName={dottedName as DottedName}>
<Trans>En savoir plus</Trans>
</RuleLink>
)}
<HideButton
className="hide"
aria-label="close"
onClick={() => dispatch(hideNotification(dottedName))}
<Appear>
{messages.map(({ sévérité, dottedName, résumé, description }) => (
<Message
icon
type={sévérité === 'avertissement' ? 'info' : 'primary'}
key={dottedName}
>
×
</HideButton>
</Message>
))}
<Markdown>{résumé ?? description ?? ''}</Markdown>{' '}
{résumé && (
<RuleLink dottedName={dottedName as DottedName}>
<Trans>En savoir plus</Trans>
</RuleLink>
)}
<HideButton
className="hide"
aria-label="close"
onClick={() => dispatch(hideNotification(dottedName))}
>
×
</HideButton>
</Message>
))}
</Appear>
</div>
)
}