Skip to content

Commit 9f7856f

Browse files
committed
feat: update ClipboardButton to use handleSuccess callback and bump package version
1 parent 51b0ced commit 9f7856f

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
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": "1.10.0-patch-1-beta-1",
3+
"version": "1.10.0-patch-1-beta-2",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const ClipboardButton = ({
3737
copyToClipboardPromise,
3838
rootClassName = '',
3939
iconSize = 16,
40-
onClick,
40+
handleSuccess,
4141
}: ClipboardProps) => {
4242
const [copied, setCopied] = useState<boolean>(false)
4343
const setCopiedFalseTimeoutRef = useRef<ReturnType<typeof setTimeout>>(-1)
@@ -60,6 +60,7 @@ export const ClipboardButton = ({
6060
await copyToClipboardPromise
6161
}
6262

63+
handleSuccess?.()
6364
handleTriggerCopy()
6465
} catch {
6566
noop()
@@ -71,7 +72,6 @@ export const ClipboardButton = ({
7172
stopPropagation(e)
7273
}
7374

74-
onClick?.()
7575
await handleAwaitCopyToClipboardPromise(true)
7676
}
7777

src/Common/ClipboardButton/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ export default interface ClipboardProps {
3131
copyToClipboardPromise?: Promise<void>
3232
rootClassName?: string
3333
iconSize?: number
34-
onClick?: () => void
34+
handleSuccess?: () => void
3535
}

src/Shared/Components/DevtronLicenseCard/DevtronLicenseCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const DevtronLicenseCard = ({
2727
isTrial,
2828
ttl,
2929
appTheme,
30-
onCopyButtonClick,
30+
handleCopySuccess,
3131
}: DevtronLicenseCardProps) => {
3232
const { bgColor, textColor } = getLicenseColorsAccordingToStatus(licenseStatus)
3333
const remainingTime = getTTLInHumanReadableFormat(ttl)
@@ -109,7 +109,7 @@ export const DevtronLicenseCard = ({
109109
<ClipboardButton
110110
initialTippyText="Copy license key"
111111
content={licenseKey}
112-
onClick={onCopyButtonClick}
112+
handleSuccess={handleCopySuccess}
113113
/>
114114
)}
115115
</div>

src/Shared/Components/DevtronLicenseCard/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export type DevtronLicenseCardProps = {
1616
} & (
1717
| {
1818
licenseKey: string
19-
onCopyButtonClick?: () => void
19+
handleCopySuccess?: () => void
2020
licenseSuffix?: never
2121
}
2222
| {
2323
licenseKey?: never
24-
onCopyButtonClick?: never
24+
handleCopySuccess?: never
2525
licenseSuffix: string
2626
}
2727
)

0 commit comments

Comments
 (0)