1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 21:14:18 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/BoxAlerts.js

30 lines
824 B
JavaScript
Raw Normal View History

import React, { useMemo } from "react"
2021-05-25 15:06:53 +00:00
import BoxFullScrollable from "../base/BoxFullScrollable"
import SummaryAlert from "./SummaryAlert"
import useStrings from "../../hooks/useStrings"
import Empty from "./Empty"
2021-05-25 15:06:53 +00:00
export default function BoxAlerts({ alerts, destroy, running, ...props }) {
const strings = useStrings()
const content = useMemo(
() => {
if(alerts.length === 0) {
return <Empty/>
}
return alerts.map(alert => (
2021-05-30 15:47:11 +00:00
<SummaryAlert alert={alert} destroy={() => destroy(alert["id"])} key={alert["id"]} running={running}/>
))
},
[alerts, running, destroy]
)
2021-05-25 15:06:53 +00:00
return (
<BoxFullScrollable header={strings.alertTitle} {...props}>
{content}
2021-05-25 15:06:53 +00:00
</BoxFullScrollable>
)
}