feat: initial editor files, add toast

This commit is contained in:
2024-02-24 00:30:24 +00:00
parent 8bb3d2bd84
commit 49b80a2f4c
11 changed files with 108 additions and 22 deletions
+13
View File
@@ -1,5 +1,7 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import copyToClipboard from "copy-to-clipboard";
import { toast } from "sonner";
import { BASE_URL } from "./consts";
import type { ProjectSchema } from "~/server/db/schema/project";
import type { FileSchema } from "~/server/db/schema/file";
@@ -33,3 +35,14 @@ export const ucfirst = (str: string) => {
export const ucwords = (str: string) => {
return str.split(" ").map(ucfirst).join(" ");
};
export const copy = (text: string) => {
copyToClipboard(text, {
onCopy: (data) => {
toast.success("Copied to clipboard!");
return data;
},
});
};
export { toast };