1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 06:24:19 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/BoxAlerts.js

29 lines
806 B
JavaScript

import React, { useMemo } from "react"
import BoxFullScrollable from "../base/BoxFullScrollable"
import SummaryAlert from "./SummaryAlert"
import useStrings from "../../hooks/useStrings"
import Empty from "./Empty"
export default function BoxAlerts({ alerts, destroy, running, ...props }) {
const strings = useStrings()
const content = useMemo(
() => {
if(alerts.length === 0) {
return <Empty/>
}
return alerts.map(alert => (
<SummaryAlert alert={alert} destroy={() => destroy(alert["id"])} running={running}/>
))
},
[alerts, running, destroy]
)
return (
<BoxFullScrollable header={strings.alertTitle} {...props}>
{content}
</BoxFullScrollable>
)
}