import React, { useMemo, useState } from 'react'; import { Modal } from '@grafana/ui'; import { StateHistory } from '../components/rules/StateHistory'; function useStateHistoryModal(alertId: string) { const [showModal, setShowModal] = useState(false); const StateHistoryModal = useMemo( () => ( setShowModal(false)} closeOnBackdropClick={true} closeOnEscape={true} title="State history" > ), [alertId, showModal] ); return { StateHistoryModal, showStateHistoryModal: () => setShowModal(true), hideStateHistoryModal: () => setShowModal(false), }; } export { useStateHistoryModal };