@omniumretail/component-library 1.2.52 → 1.2.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,5 +3,5 @@ import { HeaderProps } from './Header.types';
|
|
|
3
3
|
* Header component to display navigation bar with dropdown menus and action button.
|
|
4
4
|
* @param {HeaderProps} props - Properties passed to the component.
|
|
5
5
|
*/
|
|
6
|
-
export declare const Header: ({ menuList, actionButton, logout, homeUrl, profileUrl, onLeavingPage, userName, pageTitle, onFilterChange, notifications, onNotificationClick, handleMarkAllAsRead }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const Header: ({ menuList, actionButton, logout, homeUrl, profileUrl, onLeavingPage, userName, pageTitle, onFilterChange, notifications, onNotificationClick, handleMarkAllAsRead, shouldConfirmNavigation }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default Header;
|
package/package.json
CHANGED
|
@@ -24,7 +24,8 @@ export const Header = ({
|
|
|
24
24
|
onFilterChange,
|
|
25
25
|
notifications,
|
|
26
26
|
onNotificationClick,
|
|
27
|
-
handleMarkAllAsRead
|
|
27
|
+
handleMarkAllAsRead,
|
|
28
|
+
shouldConfirmNavigation
|
|
28
29
|
}: HeaderProps) => {
|
|
29
30
|
|
|
30
31
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
@@ -36,7 +37,9 @@ export const Header = ({
|
|
|
36
37
|
* Handle the logout action. If no logout function is provided, redirect to home as discussed in a meet
|
|
37
38
|
*/
|
|
38
39
|
const onLogout = () => {
|
|
39
|
-
if (
|
|
40
|
+
if (shouldConfirmNavigation) {
|
|
41
|
+
onLeavingPage!('/logout');
|
|
42
|
+
} else if (logout) {
|
|
40
43
|
logout();
|
|
41
44
|
} else {
|
|
42
45
|
onHome();
|
|
@@ -47,14 +50,22 @@ export const Header = ({
|
|
|
47
50
|
* Navigate to the profile URL.
|
|
48
51
|
*/
|
|
49
52
|
const onProfile = () => {
|
|
50
|
-
|
|
53
|
+
if (shouldConfirmNavigation) {
|
|
54
|
+
onLeavingPage!('/profile');
|
|
55
|
+
} else {
|
|
56
|
+
window.location.href = profileUrl;
|
|
57
|
+
}
|
|
51
58
|
};
|
|
52
59
|
|
|
53
60
|
/**
|
|
54
61
|
* Navigate to the home URL.
|
|
55
62
|
*/
|
|
56
63
|
const onHome = () => {
|
|
57
|
-
|
|
64
|
+
if (shouldConfirmNavigation) {
|
|
65
|
+
onLeavingPage!('/home');
|
|
66
|
+
} else {
|
|
67
|
+
window.location.href = homeUrl;
|
|
68
|
+
}
|
|
58
69
|
};
|
|
59
70
|
|
|
60
71
|
const menuTopList = getMenuTopList(
|