Make the "Copied!" message disappear automatically after some time

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-03-14 13:10:07 +01:00
parent b488802345
commit 3fa4169682
2 changed files with 12 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
Make the "Copied!" message disappear automatically after some time
@@ -90,9 +90,13 @@ export function EntityContextMenu(props: EntityContextMenuProps) {
const alertApi = useApi(alertApiRef);
const copyToClipboard = useCallback(() => {
window.navigator.clipboard
.writeText(window.location.toString())
.then(() => alertApi.post({ message: 'Copied!', severity: 'info' }));
window.navigator.clipboard.writeText(window.location.toString()).then(() =>
alertApi.post({
message: 'Copied!',
severity: 'info',
display: 'transient',
}),
);
}, [alertApi]);
const extraItems = UNSTABLE_extraContextMenuItems && [