-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
203 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { faL } from "@fortawesome/free-solid-svg-icons"; | ||
import React from "react"; | ||
import Swal from "sweetalert2"; | ||
|
||
// 定义Props类型 | ||
interface SweetAlertComponentProps { | ||
index: number; | ||
removeReferenceUpdateIndex: (index: number, rmPg: boolean) => void; | ||
} | ||
|
||
const ParagraphDeleteButton: React.FC<SweetAlertComponentProps> = ({ | ||
index, | ||
removeReferenceUpdateIndex, | ||
}) => { | ||
const showAlert = async () => { | ||
const result = await Swal.fire({ | ||
title: "需要同时删除与文献相关的整个段落吗?", | ||
text: "根据周围的换行符来判断是否是同一个段落", | ||
icon: "warning", | ||
showCancelButton: true, | ||
confirmButtonColor: "#3085d6", | ||
cancelButtonColor: "#d33", | ||
confirmButtonText: "Yes, delete it!", | ||
}); | ||
if (result.isConfirmed) { | ||
removeReferenceUpdateIndex(index, true); | ||
// Swal.fire("Deleted!", "Your file has been deleted.", "success"); | ||
} else { | ||
removeReferenceUpdateIndex(index, false); | ||
// Swal.fire("Cancelled", "Your imaginary file is safe :)", "error"); | ||
} | ||
}; | ||
|
||
return ( | ||
<button | ||
className="text-red-500 hover:text-red-700 ml-4" | ||
onClick={showAlert} // 直接使用showAlert而不传递参数 | ||
> | ||
X | ||
</button> | ||
); | ||
}; | ||
|
||
export default ParagraphDeleteButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters