docs: add copy subscriber button (#12405)
* docs: add copy subscriber button * re-generate * fixes + update copy button
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"use client"
|
||||
|
||||
import React from "react"
|
||||
import { CopyButton, useGenerateSnippet, UseGenerateSnippet } from "../.."
|
||||
import { SquareTwoStack, CheckCircle } from "@medusajs/icons"
|
||||
|
||||
export type CopyGeneratedSnippetButtonProps = UseGenerateSnippet & {
|
||||
tooltipText?: string
|
||||
}
|
||||
|
||||
export const CopyGeneratedSnippetButton = ({
|
||||
tooltipText,
|
||||
...props
|
||||
}: CopyGeneratedSnippetButtonProps) => {
|
||||
const { snippet } = useGenerateSnippet(props)
|
||||
|
||||
return (
|
||||
<CopyButton
|
||||
text={snippet}
|
||||
tooltipText={tooltipText}
|
||||
className="inline-block w-fit"
|
||||
>
|
||||
{({ isCopied }) => {
|
||||
if (isCopied) {
|
||||
return <CheckCircle />
|
||||
}
|
||||
return <SquareTwoStack />
|
||||
}}
|
||||
</CopyButton>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user