Add copy hooks

Add copy button on post
This commit is contained in:
DefectingCat
2022-10-24 11:27:47 +08:00
parent 41d762156b
commit fd5315c63b
4 changed files with 84 additions and 8 deletions

View File

@ -3,10 +3,10 @@ import { useState } from 'react';
import styles from './CopytButton.module.css';
export type CopyButtonProps = {
onClick?: () => void;
onCopy?: () => void;
};
const CopyButton = ({ onClick }: CopyButtonProps) => {
const CopyButton = ({ onCopy: onClick }: CopyButtonProps) => {
const [copied, setCopied] = useState(false);
const handleClick = () => {
onClick?.();