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

30 lines
806 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 => (
<SummaryAlert alert={alert} destroy={() => destroy(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>
)
}