31 lines
831 B
TypeScript
31 lines
831 B
TypeScript
import { Trash } from 'iconsax-react'
|
|
import { type FC, useState } from 'react'
|
|
import ModalConfrim from './ModalConfrim'
|
|
|
|
interface Props {
|
|
onDelete: () => void,
|
|
isloading?: boolean,
|
|
colorIcon?: string,
|
|
}
|
|
|
|
const TrashWithConfrim: FC<Props> = ({ onDelete, colorIcon, isloading = false }) => {
|
|
const [isConfirm, setIsConfirm] = useState(false)
|
|
return (
|
|
<div>
|
|
<Trash
|
|
onClick={() => setIsConfirm(true)}
|
|
className='size-[18px]'
|
|
color={colorIcon ? colorIcon : '#888'}
|
|
/>
|
|
|
|
<ModalConfrim
|
|
isOpen={isConfirm}
|
|
close={() => setIsConfirm(false)}
|
|
onConfrim={() => onDelete()}
|
|
isloading={isloading}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default TrashWithConfrim |