mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-26 18:51:50 +02:00
* Convert OLModal to named exports only
* Make closeButton the default for OLModalHeader
* Set `closeButton={false}` for modal that is not dismissible
* Fix duplicated imports
* Remove another unnecessary `closeButton` prop
* Fix import
---------
Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com>
GitOrigin-RevId: ddd7be6e59a966ac634683d2494d6e9d2c3732e6
45 lines
1002 B
TypeScript
45 lines
1002 B
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import { memo } from 'react'
|
|
import {
|
|
OLModal,
|
|
OLModalBody,
|
|
OLModalFooter,
|
|
OLModalHeader,
|
|
OLModalTitle,
|
|
} from '@/shared/components/ol/ol-modal'
|
|
import OLButton from '@/shared/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>
|
|
<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)
|