mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Update code, create booking services
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { memo } from 'react';
|
||||
import { memo, useCallback } from 'react';
|
||||
|
||||
// Styled
|
||||
import { StyledConfirmDelete } from './styled';
|
||||
@@ -8,27 +8,27 @@ import Button from '@commonStyle/Button';
|
||||
|
||||
interface IConfirmMessage {
|
||||
message: string;
|
||||
disabled: boolean;
|
||||
onConfirm: () => void;
|
||||
onCloseModal?: () => void;
|
||||
}
|
||||
|
||||
const ConfirmMessage = memo(
|
||||
({ message, disabled, onConfirm, onCloseModal }: IConfirmMessage) => {
|
||||
({ message, onConfirm, onCloseModal }: IConfirmMessage) => {
|
||||
const handleConfirmBtn = useCallback(() => {
|
||||
onConfirm();
|
||||
onCloseModal!();
|
||||
}, [onCloseModal, onConfirm]);
|
||||
|
||||
return (
|
||||
<StyledConfirmDelete>
|
||||
<p>{message}</p>
|
||||
|
||||
<div>
|
||||
<Button variations="danger" disabled={disabled} onClick={onConfirm}>
|
||||
Delete
|
||||
<Button variations="danger" onClick={handleConfirmBtn}>
|
||||
Yes
|
||||
</Button>
|
||||
<Button
|
||||
variations="secondary"
|
||||
disabled={disabled}
|
||||
onClick={onCloseModal}
|
||||
>
|
||||
Cancel
|
||||
<Button variations="secondary" onClick={onCloseModal}>
|
||||
No
|
||||
</Button>
|
||||
</div>
|
||||
</StyledConfirmDelete>
|
||||
|
||||
Reference in New Issue
Block a user