import { CheckOutlined } from '@ant-design/icons'; import { Tooltip } from 'antd'; import { useResponsive } from 'antd-style'; import copy from 'copy-to-clipboard'; import { FC } from 'react'; import { Highlighter } from '../Highlighter'; import { vs, vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism'; import { useCopied } from '../../hooks/useCopied'; import { useStyles } from './style'; const CodeSnippet: FC<{ children: string }> = ({ children }) => { const { styles, theme } = useStyles(); const { mobile } = useResponsive(); const { copied, setCopied } = useCopied(); return ( 复制成功 ) : ( '复制' ) } >
{ copy(children); setCopied(); }} > {children}
); }; export default CodeSnippet;