[MM-56006] Convert ./components/discard_changes_modal.tsx from Class Component to Function Component (#25620)
* MM-56006: Converted to React FC * Update webapp/channels/src/components/discard_changes_modal.tsx Co-authored-by: Daniel Espino García <larkox@gmail.com> * lint changes --------- Co-authored-by: Daniel Espino García <larkox@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c008c95c93
Коммит
1dae805ee1
@@ -12,16 +12,19 @@ type Props = {
|
|||||||
onCancel: (checked: boolean) => void;
|
onCancel: (checked: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class DiscardChangesModal extends React.PureComponent<Props> {
|
const DiscardChangesModal = ({
|
||||||
public render(): JSX.Element {
|
show,
|
||||||
const title: JSX.Element = (
|
onConfirm,
|
||||||
|
onCancel,
|
||||||
|
}: Props) => {
|
||||||
|
const title = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='discard_changes_modal.title'
|
id='discard_changes_modal.title'
|
||||||
defaultMessage='Discard Changes?'
|
defaultMessage='Discard Changes?'
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
const message: JSX.Element = (
|
const message = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='discard_changes_modal.message'
|
id='discard_changes_modal.message'
|
||||||
defaultMessage='You have unsaved changes, are you sure you want to discard them?'
|
defaultMessage='You have unsaved changes, are you sure you want to discard them?'
|
||||||
@@ -29,7 +32,7 @@ export default class DiscardChangesModal extends React.PureComponent<Props> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const buttonClass = 'btn btn-primary';
|
const buttonClass = 'btn btn-primary';
|
||||||
const button: JSX.Element = (
|
const button = (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='discard_changes_modal.leave'
|
id='discard_changes_modal.leave'
|
||||||
defaultMessage='Yes, Discard'
|
defaultMessage='Yes, Discard'
|
||||||
@@ -38,8 +41,6 @@ export default class DiscardChangesModal extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
const modalClass = 'discard-changes-modal';
|
const modalClass = 'discard-changes-modal';
|
||||||
|
|
||||||
const {show, onConfirm, onCancel} = this.props;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
show={show}
|
show={show}
|
||||||
@@ -52,5 +53,6 @@ export default class DiscardChangesModal extends React.PureComponent<Props> {
|
|||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
export default React.memo(DiscardChangesModal);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user