hedgedoc/src/components/editor-page/editor-modals/max-length-warning-modal.tsx
Tilman Vatteroth e0a0c86846
Deduplicate CommonModal Props (#1649)
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-11-26 21:51:12 +01:00

41 lines
1.3 KiB
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Button, Modal } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next'
import type { ModalVisibilityProps } from '../../common/modals/common-modal'
import { CommonModal } from '../../common/modals/common-modal'
import { cypressId } from '../../../utils/cypress-attribute'
export interface MaxLengthWarningModalProps extends ModalVisibilityProps {
maxLength: number
}
export const MaxLengthWarningModal: React.FC<MaxLengthWarningModalProps> = ({ show, onHide, maxLength }) => {
useTranslation()
return (
<CommonModal
{...cypressId('limitReachedModal')}
show={show}
onHide={onHide}
title={'editor.error.limitReached.title'}
showCloseButton={true}>
<Modal.Body>
<Trans i18nKey={'editor.error.limitReached.description'} values={{ maxLength }} />
<strong className='mt-2 d-block'>
<Trans i18nKey={'editor.error.limitReached.advice'} />
</strong>
</Modal.Body>
<Modal.Footer>
<Button onClick={onHide}>
<Trans i18nKey={'common.close'} />
</Button>
</Modal.Footer>
</CommonModal>
)
}