wwf
2 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
app/components/base/copy-feedback/index.tsx
@@ -1,15 +1,10 @@
'use client'
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
  RiClipboardFill,
  RiClipboardLine,
} from '@remixicon/react'
import { debounce } from 'lodash-es'
import copy from 'copy-to-clipboard'
import copyStyle from './style.module.css'
import Tooltip from '@/app/components/base/tooltip'
import ActionButton from '@/app/components/base/action-button'
type Props = {
  content: string
@@ -18,7 +13,7 @@
const prefixEmbedded = 'appOverview.overview.appInfo.embedded'
const CopyFeedback = ({ content }: Props) => {
const CopyFeedback = ({ content, className }: Props) => {
  const { t } = useTranslation()
  const [isCopied, setIsCopied] = useState<boolean>(false)
@@ -39,15 +34,19 @@
          : t(`${prefixEmbedded}.copy`)) || ''
      }
    >
      <ActionButton>
      <div
        className={`w-8 h-8 cursor-pointer hover:bg-gray-100 rounded-lg ${
          className ?? ''
        }`}
      >
        <div
          onClick={onClickCopy}
          onMouseLeave={onMouseLeave}
        >
          {isCopied && <RiClipboardFill className='h-4 w-4' />}
          {!isCopied && <RiClipboardLine className='h-4 w-4' />}
        </div>
      </ActionButton>
          className={`w-full h-full ${copyStyle.copyIcon} ${
            isCopied ? copyStyle.copied : ''
          }`}
        ></div>
      </div>
    </Tooltip>
  )
}
@@ -76,13 +75,15 @@
      }
    >
      <div
        className={`h-8 w-8 cursor-pointer rounded-lg hover:bg-components-button-ghost-bg-hover ${className ?? ''
        className={`w-8 h-8 cursor-pointer hover:bg-gray-100 rounded-lg ${
          className ?? ''
        }`}
      >
        <div
          onClick={onClickCopy}
          onMouseLeave={onMouseLeave}
          className={`h-full w-full ${copyStyle.copyIcon} ${isCopied ? copyStyle.copied : ''
          className={`w-full h-full ${copyStyle.copyIcon} ${
            isCopied ? copyStyle.copied : ''
          }`}
        ></div>
      </div>