diff --git a/src/app/(.)/poem/[id]/components/Copy.tsx b/src/app/(.)/poem/[id]/components/Copy.tsx new file mode 100644 index 00000000..6f7c0bed --- /dev/null +++ b/src/app/(.)/poem/[id]/components/Copy.tsx @@ -0,0 +1,61 @@ +"use client"; + +import { type Poem, type Author } from "@prisma/client"; +import { Check, ClipboardCopy } from "lucide-react"; +import { Button } from "~/components/ui/button"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "~/components/ui/popover"; +import { MyHost, cn } from "~/utils"; + +interface Props { + data: Poem & { author: Author }; + className?: string; +} + +const CopyButton = (props: Props) => { + const { data: poem } = props; + + return ( + + + + + +
+ + 已复制 +
+
+
+ ); +}; + +export default CopyButton; diff --git a/src/app/(.)/poem/[id]/page.tsx b/src/app/(.)/poem/[id]/page.tsx index 906e218d..27721645 100644 --- a/src/app/(.)/poem/[id]/page.tsx +++ b/src/app/(.)/poem/[id]/page.tsx @@ -1,4 +1,10 @@ -import { Album, ChevronRight, InfoIcon, TwitterIcon } from "lucide-react"; +import { + Album, + ChevronRight, + ClipboardCopy, + InfoIcon, + TwitterIcon, +} from "lucide-react"; import Link from "next/link"; import { notFound } from "next/navigation"; import { HeaderMain } from "~/components/ui/header"; @@ -11,6 +17,8 @@ import { MyHost, cn } from "~/utils"; import dynamic from "next/dynamic"; import { type Article, type WithContext } from "schema-dts"; import { getPoemTitle } from "./utils"; +import { Separator } from "~/components/ui/separator"; +import CopyButton from "./components/Copy"; const Twikoo = dynamic(() => import("./components/twikoo"), { ssr: false, @@ -143,7 +151,8 @@ export default async function Page({ params, searchParams }: Props) { -
+ {/* 正文 */} +
{/* 标题 */} + +
+ {/* 标签 */}
{poem.tags.length > 0 && ( -
+
{poem.tags.map((item) => { return ( -
)} +

译文