File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import { Card } from "@/components/ui/card"
22// import { Rocket } from "lucide-react"
33import { MarkdownRenderer } from "./markdown-renderer"
44import { useMarkdown } from "@/context/ReleaseNoteContext"
5+ import { Copy } from "lucide-react" ;
6+ import { copyText } from "@/lib/helpers/copyText" ;
57
68
79export function ReleasePreview ( ) {
@@ -10,6 +12,13 @@ export function ReleasePreview() {
1012 < div className = "space-y-4" >
1113 < div className = "flex items-center justify-between" >
1214 < h2 className = "text-2xl font-bold text-foreground" > Preview</ h2 >
15+ {
16+ markdown && (
17+ < button onClick = { ( ) => copyText ( markdown ) } >
18+ < Copy />
19+ </ button >
20+ )
21+ }
1322 </ div >
1423
1524 < Card className = "p-6 bg-card shadow-elevation min-h-[500px]" >
Original file line number Diff line number Diff line change 1+ import { toast } from "sonner" ;
2+ export async function copyText ( text : string ) {
3+ const promise = async ( ) => {
4+ await navigator . clipboard . writeText ( text ) ;
5+ }
6+
7+ toast . promise ( promise ( ) , {
8+ loading : "Copying text..." ,
9+ success : "Text copied to clipboard" ,
10+ error : "Failed to copy text" ,
11+ } ) ;
12+ }
You can’t perform that action at this time.
0 commit comments