Skip to content

Commit df34dac

Browse files
authored
Merge pull request #291 from devtron-labs/chore/main-merge
chore: main sync
2 parents cf30e8a + d6a1a6e commit df34dac

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.2.28",
3+
"version": "0.2.29",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function ClipboardButton({
3434
content,
3535
copiedTippyText = 'Copied!',
3636
duration = 1000,
37-
trigger = false,
37+
trigger,
3838
setTrigger = noop,
3939
rootClassName = '',
4040
iconSize = 16,
@@ -45,6 +45,8 @@ export default function ClipboardButton({
4545
const handleTextCopied = () => {
4646
setCopied(true)
4747
}
48+
const isTriggerUndefined = typeof trigger === 'undefined'
49+
4850
const handleEnableTippy = () => setEnableTippy(true)
4951
const handleDisableTippy = () => setEnableTippy(false)
5052
const handleCopyContent = useCallback(
@@ -68,7 +70,7 @@ export default function ClipboardButton({
6870
}, [copied, duration, setTrigger])
6971

7072
useEffect(() => {
71-
if (trigger) {
73+
if (!isTriggerUndefined && trigger) {
7274
setCopied(true)
7375
handleCopyContent()
7476
}
@@ -86,7 +88,7 @@ export default function ClipboardButton({
8688
className={`dc__outline-none-imp p-0 flex dc__transparent--unstyled dc__no-border ${rootClassName}`}
8789
onMouseEnter={handleEnableTippy}
8890
onMouseLeave={handleDisableTippy}
89-
onClick={handleCopyContent}
91+
onClick={isTriggerUndefined && handleCopyContent}
9092
>
9193
{copied ? <Check className={iconClassName} /> : <ICCopy className={iconClassName} />}
9294
</button>

0 commit comments

Comments
 (0)