Skip to content

Commit

Permalink
remove tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
baurine committed Nov 24, 2020
1 parent 79226a4 commit d609231
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions ui/lib/components/CopyLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState } from 'react'
import { CopyToClipboard } from 'react-copy-to-clipboard'
import { useTranslation } from 'react-i18next'
import { useTimeoutFn } from 'react-use'
import { Tooltip } from 'antd'
import { CheckOutlined, CopyOutlined } from '@ant-design/icons'
import { addTranslationResource } from '@lib/utils/i18n'

Expand All @@ -26,14 +25,12 @@ const translations = {
copyOriginal: 'Copy Original',
copyFormatted: 'Copy Formatted',
success: 'Copied',
tooltip: 'Copy by this button if you need to run it in SQL client',
},
zh: {
copy: '复制',
copyOriginal: '复制原始 SQL',
copyFormatted: '复制格式化 SQL',
success: '已复制',
tooltip: '如果你需要在 SQL 客户端执行此 SQL 语句,请使用这个按钮进行复制',
},
}

Expand All @@ -58,20 +55,16 @@ function CopyLink({ data, displayVariant = 'default' }: ICopyLinkProps) {
reset()
}

const copyBtn = (
<CopyToClipboard text={data} onCopy={handleCopy}>
<a>
{t(`component.copyLink.${transKeys[displayVariant]}`)} <CopyOutlined />
</a>
</CopyToClipboard>
)

return (
<span>
{!showCopied && displayVariant === 'original_sql' && (
<Tooltip title={t('component.copyLink.tooltip')}>{copyBtn}</Tooltip>
{!showCopied && (
<CopyToClipboard text={data} onCopy={handleCopy}>
<a>
{t(`component.copyLink.${transKeys[displayVariant]}`)}{' '}
<CopyOutlined />
</a>
</CopyToClipboard>
)}
{!showCopied && displayVariant !== 'original_sql' && copyBtn}
{showCopied && (
<span className={styles.copiedText}>
<CheckOutlined /> {t('component.copyLink.success')}
Expand Down

0 comments on commit d609231

Please sign in to comment.