hedgedoc/src/components/notifications/ui-notifications.tsx
Tilman Vatteroth 829cc2fe48
Add application state hook (#1308)
* Add application state hook

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>

* Add docs

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-06-11 15:21:24 +02:00

22 lines
746 B
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { UiNotificationToast } from './ui-notification-toast'
import './notifications.scss'
import { useApplicationState } from '../../hooks/common/use-application-state'
export const UiNotifications: React.FC = () => {
const notifications = useApplicationState((state) => state.uiNotifications)
return (
<div className={'notifications-area'} aria-live='polite' aria-atomic='true'>
{notifications.map((notification, notificationIndex) => (
<UiNotificationToast key={notificationIndex} notificationId={notificationIndex} {...notification} />
))}
</div>
)
}