From 3fa416968208bbc7a462174a3a926cffc5a611e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Tue, 14 Mar 2023 13:10:07 +0100 Subject: [PATCH] Make the "Copied!" message disappear automatically after some time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/brave-planets-grab.md | 5 +++++ .../components/EntityContextMenu/EntityContextMenu.tsx | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changeset/brave-planets-grab.md diff --git a/.changeset/brave-planets-grab.md b/.changeset/brave-planets-grab.md new file mode 100644 index 0000000000..8b99978695 --- /dev/null +++ b/.changeset/brave-planets-grab.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Make the "Copied!" message disappear automatically after some time diff --git a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx index 675f74fa8d..1961fe6cac 100644 --- a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx +++ b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx @@ -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 && [