overleaf/services/web/frontend/js/features/ide-react/components/modals/generic-message-modal.tsx
Rebeka Dekany 5b6bbcb73c Merge pull request #21008 from overleaf/rd-editor-errors
[web] Migrate notifications and error boundaries on the editor page

GitOrigin-RevId: c195ecf0dd9e38ec8326c823174e559e1f192ce1
2024-10-14 11:09:36 +00:00

43 lines
1,022 B
TypeScript

import { useTranslation } from 'react-i18next'
import { memo } from 'react'
import OLModal, {
OLModalBody,
OLModalFooter,
OLModalHeader,
OLModalTitle,
} from '@/features/ui/components/ol/ol-modal'
import OLButton from '@/features/ui/components/ol/ol-button'
export type GenericMessageModalOwnProps = {
title: string
message: string
}
type GenericMessageModalProps = React.ComponentProps<typeof OLModal> &
GenericMessageModalOwnProps
function GenericMessageModal({
title,
message,
...modalProps
}: GenericMessageModalProps) {
const { t } = useTranslation()
return (
<OLModal {...modalProps}>
<OLModalHeader closeButton>
<OLModalTitle>{title}</OLModalTitle>
</OLModalHeader>
<OLModalBody className="modal-body-share">{message}</OLModalBody>
<OLModalFooter>
<OLButton variant="secondary" onClick={() => modalProps.onHide()}>
{t('ok')}
</OLButton>
</OLModalFooter>
</OLModal>
)
}
export default memo(GenericMessageModal)