2
0

🐛 (share) Fix clipboard for updated typebot ID

Closes #215
This commit is contained in:
Baptiste Arnaud
2023-01-06 14:45:09 +01:00
parent 6cc3cbf182
commit fadf34ad61
4 changed files with 9 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect } from 'react'
import { ButtonProps, Button, useClipboard } from '@chakra-ui/react'
interface CopyButtonProps extends ButtonProps {
@ -8,7 +8,11 @@ interface CopyButtonProps extends ButtonProps {
export const CopyButton = (props: CopyButtonProps) => {
const { textToCopy, onCopied, ...buttonProps } = props
const { hasCopied, onCopy } = useClipboard(textToCopy)
const { hasCopied, onCopy, setValue } = useClipboard(textToCopy)
useEffect(() => {
setValue(textToCopy)
}, [setValue, textToCopy])
return (
<Button

View File

@ -63,7 +63,7 @@ export const EditableUrl = ({
<HStack>
<EditButton size="xs" />
<CopyButton size="xs" textToCopy={`${hostname}/${pathname ?? ''}`} />
<CopyButton size="xs" textToCopy={`${hostname}/${value ?? ''}`} />
</HStack>
</Editable>
)