Skip to content

Commit 75054eb

Browse files
fix notification animation
1 parent 62fbefd commit 75054eb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/features/common/components/notification/notification.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
font-weight: 500;
1212
z-index: 9010;
1313
animation:
14-
fadeIn 0.3s,
15-
fadeOut 0.3s 1.7s;
14+
fadeIn 0.3s forwards,
15+
fadeOut 0.3s 1.7s forwards;
1616
box-shadow:
1717
0 0 0 1px rgba(0, 0, 0, 0.12),
1818
0 2px 2px -1px rgba(0, 0, 0, 0.04),

src/features/common/components/site-brand/site-brand.component.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { PropsWithChildren, useEffect, useState } from "react";
1+
import React, { PropsWithChildren, useCallback, useEffect, useState } from "react";
22
import styles from "./site-brand.module.scss";
33
import Link from "next/link";
44
import { getBrandDictionary } from "@/features/localization/services/brand-dictionary.service";
@@ -34,6 +34,10 @@ export const SiteBrandComponent: React.FC<SiteBrandComponentProps> = ({
3434
setMenuPosition(null);
3535
};
3636

37+
const handleNotificationClose = useCallback(() => {
38+
setIsCopied(false);
39+
}, [])
40+
3741
useEffect(() => {
3842
// Hide the menu on any click on the document
3943
document.addEventListener("click", handleCloseMenu);
@@ -69,7 +73,7 @@ export const SiteBrandComponent: React.FC<SiteBrandComponentProps> = ({
6973
</Link>
7074
<ContextMenu dictionary={brandDictionary} position={menuPosition} setIsCopied={setIsCopied}/>
7175
{isCopied && (
72-
<Notification message={brandDictionary.alertMessage} onClose={() => setIsCopied(false)}/>
76+
<Notification message={brandDictionary.alertMessage} onClose={handleNotificationClose}/>
7377
)}
7478
</div>
7579
);

0 commit comments

Comments
 (0)