Skip to content
Source
Sign inSign up
fuko/trytanstackdb-v2
Open History to see the last commit

deleted-note-banner.tsx

34 lines920 Bytes

1import { restoreNote } from "@/db/mutations";
2import { cn } from "@/lib/utils";
3​
4/** Notes in Recently Deleted are read-only, like in Notes; recover one to edit it again. */
5export function DeletedNoteBanner({
6 noteId,
7 variant,
8 onRestored,
9}: {
10 noteId: string;
11 variant: "mac" | "ios";
12 onRestored?: () => void;
13}) {
14 return (
15 <div
16 className={cn(
17 "mx-auto mt-2 mb-1 flex max-w-md items-center justify-between gap-3 rounded-xl bg-black/[0.04] px-3 py-2 dark:bg-white/[0.06]",
18 variant === "ios" ? "text-[15px]" : "text-[12px]",
19 )}
20 >
21 <span className="text-mac-text-secondary">Recently deleted notes can't be edited.</span>
22 <button
23 type="button"
24 onClick={() => {
25 restoreNote(noteId);
26 onRestored?.();
27 }}
28 className="shrink-0 font-semibold text-notes-accent"
29 >
30 Recover
31 </button>
32 </div>
33 );