@databiosphere/findable-ui 8.0.0 → 8.0.2
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.
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Content/components/Navigation/navigation.styles.js +2 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.d.ts +1 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.d.ts +2 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.d.ts +2 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.js +10 -4
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.d.ts +2 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.js +3 -3
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.d.ts +1 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.js +3 -3
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.styles.js +1 -0
- package/lib/components/Layout/components/Header/header.js +7 -4
- package/lib/theme/common/components.js +17 -0
- package/package.json +1 -1
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Content/components/Navigation/navigation.styles.ts +2 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.tsx +3 -1
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.tsx +3 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.ts +15 -5
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +7 -1
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.tsx +4 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/navigation.styles.ts +1 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/navigation.tsx +12 -2
- package/src/components/Layout/components/Header/header.tsx +7 -4
- package/src/theme/common/components.ts +17 -0
- package/types/data-explorer-ui.d.ts +1 -0
|
@@ -12,7 +12,7 @@ export declare const FilterLabel: import("@emotion/styled").StyledComponent<{
|
|
|
12
12
|
size?: "large" | "medium" | "small" | undefined;
|
|
13
13
|
startIcon?: import("react").ReactNode;
|
|
14
14
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
-
variant?: "nav" | "text" | "outlined" | "contained" | undefined;
|
|
15
|
+
variant?: "nav" | "text" | "outlined" | "contained" | "activeNav" | undefined;
|
|
16
16
|
} & Omit<{
|
|
17
17
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
18
|
centerRipple?: boolean | undefined;
|
|
@@ -12,7 +12,7 @@ export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
|
12
12
|
size?: "large" | "medium" | "small" | undefined;
|
|
13
13
|
startIcon?: import("react").ReactNode;
|
|
14
14
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
-
variant?: "nav" | "text" | "outlined" | "contained" | undefined;
|
|
15
|
+
variant?: "nav" | "text" | "outlined" | "contained" | "activeNav" | undefined;
|
|
16
16
|
} & Omit<{
|
|
17
17
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
18
|
centerRipple?: boolean | undefined;
|
|
@@ -9,6 +9,7 @@ export const Navigation = styled(DXNavigation) `
|
|
|
9
9
|
margin: 0;
|
|
10
10
|
justify-content: flex-start;
|
|
11
11
|
|
|
12
|
+
.MuiButton-activeNav,
|
|
12
13
|
.MuiButton-nav {
|
|
13
14
|
${textBodyLarge500};
|
|
14
15
|
justify-content: space-between;
|
|
@@ -22,6 +23,7 @@ export const Navigation = styled(DXNavigation) `
|
|
|
22
23
|
export const DrawerNavigation = styled(Navigation) `
|
|
23
24
|
gap: 0;
|
|
24
25
|
|
|
26
|
+
.MuiButton-activeNav,
|
|
25
27
|
.MuiButton-nav {
|
|
26
28
|
${textBody500};
|
|
27
29
|
padding: 14px 24px;
|
|
@@ -9,7 +9,7 @@ import { Slogan } from "../../../Slogan/slogan";
|
|
|
9
9
|
import { Navigation } from "./components/Content/components/Navigation/navigation.styles";
|
|
10
10
|
import { Socials } from "./components/Content/components/Socials/socials.styles";
|
|
11
11
|
import { Toolbar } from "./components/Toolbar/toolbar";
|
|
12
|
-
export const Menu = forwardRef(function HeaderMenu({ closeMenu, headerProps, open, openMenu, style }, ref) {
|
|
12
|
+
export const Menu = forwardRef(function HeaderMenu({ closeMenu, headerProps, open, openMenu, pathname, style }, ref) {
|
|
13
13
|
const { navigation, slogan, socialMedia } = headerProps;
|
|
14
14
|
const { breakpoint, smDown } = useBreakpoint();
|
|
15
15
|
// Set drawer open state to false on change of media breakpoint from small desktop "md" and up.
|
|
@@ -28,6 +28,6 @@ export const Menu = forwardRef(function HeaderMenu({ closeMenu, headerProps, ope
|
|
|
28
28
|
React.createElement(Toolbar, { onClose: closeMenu, ...headerProps })),
|
|
29
29
|
React.createElement(Content, null,
|
|
30
30
|
slogan && React.createElement(Slogan, { slogan: slogan }),
|
|
31
|
-
React.createElement(Navigation, { closeAncestor: closeMenu, headerProps: headerProps, links: getMenuNavigationLinks(navigation, breakpoint) }),
|
|
31
|
+
React.createElement(Navigation, { closeAncestor: closeMenu, headerProps: headerProps, links: getMenuNavigationLinks(navigation, breakpoint), pathname: pathname }),
|
|
32
32
|
socialMedia && (React.createElement(Socials, { buttonSize: "xlarge", socials: socialMedia.socials }))))));
|
|
33
33
|
});
|
|
@@ -12,7 +12,7 @@ export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
|
12
12
|
size?: "large" | "medium" | "small" | undefined;
|
|
13
13
|
startIcon?: import("react").ReactNode;
|
|
14
14
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
-
variant?: "nav" | "text" | "outlined" | "contained" | undefined;
|
|
15
|
+
variant?: "nav" | "text" | "outlined" | "contained" | "activeNav" | undefined;
|
|
16
16
|
} & Omit<{
|
|
17
17
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
18
|
centerRipple?: boolean | undefined;
|
|
@@ -6,5 +6,6 @@ export interface NavigationDrawerProps {
|
|
|
6
6
|
headerProps?: HeaderProps;
|
|
7
7
|
menuItems: MenuItem[];
|
|
8
8
|
menuLabel: ReactNode;
|
|
9
|
+
pathname?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare const NavigationDrawer: ({ closeAncestor, headerProps, menuItems, menuLabel, }: NavigationDrawerProps) => JSX.Element;
|
|
11
|
+
export declare const NavigationDrawer: ({ closeAncestor, headerProps, menuItems, menuLabel, pathname, }: NavigationDrawerProps) => JSX.Element;
|
|
@@ -8,7 +8,7 @@ import { DrawerNavigation as Navigation } from "../../../Actions/components/Menu
|
|
|
8
8
|
import { Toolbar } from "../../../Actions/components/Menu/components/Toolbar/toolbar";
|
|
9
9
|
import { Slide } from "./components/Slide/slide";
|
|
10
10
|
import { Button as BackButton, Content } from "./navigationDrawer.styles";
|
|
11
|
-
export const NavigationDrawer = ({ closeAncestor, headerProps, menuItems, menuLabel, }) => {
|
|
11
|
+
export const NavigationDrawer = ({ closeAncestor, headerProps, menuItems, menuLabel, pathname, }) => {
|
|
12
12
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
13
13
|
const openDrawer = () => {
|
|
14
14
|
setDrawerOpen(true);
|
|
@@ -27,5 +27,5 @@ export const NavigationDrawer = ({ closeAncestor, headerProps, menuItems, menuLa
|
|
|
27
27
|
React.createElement(Toolbar, { onClose: closeDrawers, ...headerProps })),
|
|
28
28
|
React.createElement(Content, null,
|
|
29
29
|
React.createElement(BackButton, { fullWidth: true, onClick: closeDrawer, StartIcon: BackArrowIcon, variant: "nav" }, menuLabel),
|
|
30
|
-
React.createElement(Navigation, { closeAncestor: closeDrawers, headerProps: headerProps, links: menuItems })))));
|
|
30
|
+
React.createElement(Navigation, { closeAncestor: closeDrawers, headerProps: headerProps, links: menuItems, pathname: pathname })))));
|
|
31
31
|
};
|
|
@@ -6,5 +6,6 @@ export interface NavLinkMenuProps {
|
|
|
6
6
|
closeAncestor?: () => void;
|
|
7
7
|
menuItems: MenuItem[];
|
|
8
8
|
menuLabel: ReactNode;
|
|
9
|
+
pathname?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare const NavigationMenu: ({ anchorOrigin, closeAncestor, menuItems, menuLabel, }: NavLinkMenuProps) => JSX.Element;
|
|
11
|
+
export declare const NavigationMenu: ({ anchorOrigin, closeAncestor, menuItems, menuLabel, pathname, }: NavLinkMenuProps) => JSX.Element;
|
|
@@ -3,7 +3,7 @@ import React, { useState } from "react";
|
|
|
3
3
|
import { useBreakpoint } from "../../../../../../../../../../hooks/useBreakpoint";
|
|
4
4
|
import { NavigationMenuItems, } from "../NavigationMenuItems/navigationMenuItems";
|
|
5
5
|
import { Button, Menu } from "./navigationMenu.styles";
|
|
6
|
-
export const NavigationMenu = ({ anchorOrigin = { horizontal: "left", vertical: "bottom" }, closeAncestor, menuItems, menuLabel, }) => {
|
|
6
|
+
export const NavigationMenu = ({ anchorOrigin = { horizontal: "left", vertical: "bottom" }, closeAncestor, menuItems, menuLabel, pathname, }) => {
|
|
7
7
|
const { mdUp } = useBreakpoint();
|
|
8
8
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
9
9
|
const open = Boolean(anchorEl);
|
|
@@ -20,5 +20,5 @@ export const NavigationMenu = ({ anchorOrigin = { horizontal: "left", vertical:
|
|
|
20
20
|
horizontal: "left",
|
|
21
21
|
vertical: "top",
|
|
22
22
|
} },
|
|
23
|
-
React.createElement(NavigationMenuItems, { closeMenu: closeMenu, menuItems: menuItems }))));
|
|
23
|
+
React.createElement(NavigationMenuItems, { closeMenu: closeMenu, menuItems: menuItems, pathname: pathname }))));
|
|
24
24
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { css } from "@emotion/react";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
3
|
import { Menu as MMenu } from "@mui/material";
|
|
4
|
+
import { inkLight, smokeLight, smokeMain, } from "../../../../../../../../../../styles/common/mixins/colors";
|
|
4
5
|
import { Button as DXButton } from "../../../../../../../../../common/Button/button";
|
|
5
6
|
export const Menu = styled(MMenu) `
|
|
6
7
|
.MuiPaper-menu {
|
|
7
|
-
border-color: ${
|
|
8
|
+
border-color: ${smokeMain};
|
|
8
9
|
margin: 4px 0;
|
|
9
10
|
max-width: 324px;
|
|
10
11
|
min-width: 204px;
|
|
@@ -31,12 +32,17 @@ export const Menu = styled(MMenu) `
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
.MuiListItemText-secondary {
|
|
34
|
-
color: ${
|
|
35
|
+
color: ${inkLight};
|
|
35
36
|
white-space: normal;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
|
|
40
|
+
&.Mui-selected {
|
|
41
|
+
background-color: ${smokeLight};
|
|
42
|
+
}
|
|
38
43
|
}
|
|
39
44
|
|
|
45
|
+
.MuiButton-activeNav,
|
|
40
46
|
.MuiButton-nav {
|
|
41
47
|
font-weight: 400;
|
|
42
48
|
justify-content: space-between;
|
|
@@ -57,8 +63,8 @@ export const Button = styled(DXButton, {
|
|
|
57
63
|
shouldForwardProp: (prop) => prop !== "isActive",
|
|
58
64
|
}) `
|
|
59
65
|
// Button is "active" i.e. menu is open.
|
|
60
|
-
${(
|
|
66
|
+
${(props) => props.isActive &&
|
|
61
67
|
css `
|
|
62
|
-
background-color: ${
|
|
68
|
+
background-color: ${smokeLight(props)};
|
|
63
69
|
`};
|
|
64
70
|
`;
|
|
@@ -7,5 +7,6 @@ export interface MenuItem extends NavLinkItem {
|
|
|
7
7
|
export interface NavLinkMenuProps {
|
|
8
8
|
closeMenu: () => void;
|
|
9
9
|
menuItems: MenuItem[];
|
|
10
|
+
pathname?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare const NavigationMenuItems: ({ closeMenu, menuItems, }: NavLinkMenuProps) => JSX.Element;
|
|
12
|
+
export declare const NavigationMenuItems: ({ closeMenu, menuItems, pathname, }: NavLinkMenuProps) => JSX.Element;
|
|
@@ -5,15 +5,15 @@ import { TEXT_BODY_400, TEXT_BODY_500, TEXT_BODY_SMALL_400_2_LINES, } from "../.
|
|
|
5
5
|
import { ANCHOR_TARGET } from "../../../../../../../../../Links/common/entities";
|
|
6
6
|
import { isClientSideNavigation } from "../../../../../../../../../Links/common/utils";
|
|
7
7
|
import { NavigationMenu } from "../NavigationMenu/navigationMenu";
|
|
8
|
-
export const NavigationMenuItems = ({ closeMenu, menuItems, }) => {
|
|
8
|
+
export const NavigationMenuItems = ({ closeMenu, menuItems, pathname, }) => {
|
|
9
9
|
const router = useRouter();
|
|
10
|
-
return (React.createElement(React.Fragment, null, menuItems.map(({ description, divider, icon, label, menuItems: nestedMenuItems, target = ANCHOR_TARGET.SELF, url, }, i) => nestedMenuItems ? (React.createElement(NavigationMenu, { key: i, anchorOrigin: { horizontal: "right", vertical: "top" }, closeAncestor: closeMenu, menuItems: nestedMenuItems, menuLabel: label })) : (React.createElement(Fragment, { key: i },
|
|
10
|
+
return (React.createElement(React.Fragment, null, menuItems.map(({ description, divider, icon, label, menuItems: nestedMenuItems, target = ANCHOR_TARGET.SELF, url, }, i) => nestedMenuItems ? (React.createElement(NavigationMenu, { key: i, anchorOrigin: { horizontal: "right", vertical: "top" }, closeAncestor: closeMenu, menuItems: nestedMenuItems, menuLabel: label, pathname: pathname })) : (React.createElement(Fragment, { key: i },
|
|
11
11
|
React.createElement(MMenuItem, { onClick: () => {
|
|
12
12
|
closeMenu();
|
|
13
13
|
isClientSideNavigation(url)
|
|
14
14
|
? router.push(url)
|
|
15
15
|
: window.open(url, target, "noopener noreferrer");
|
|
16
|
-
} },
|
|
16
|
+
}, selected: url === pathname },
|
|
17
17
|
icon && React.createElement(ListItemIcon, null, icon),
|
|
18
18
|
React.createElement(ListItemText, { primary: label, primaryTypographyProps: {
|
|
19
19
|
variant: description ? TEXT_BODY_500 : TEXT_BODY_400,
|
|
@@ -17,6 +17,7 @@ export interface NavigationProps {
|
|
|
17
17
|
closeAncestor?: () => void;
|
|
18
18
|
headerProps?: HeaderProps;
|
|
19
19
|
links: NavLinkItem[];
|
|
20
|
+
pathname?: string;
|
|
20
21
|
style?: CSSProperties;
|
|
21
22
|
}
|
|
22
23
|
export declare const Navigation: React.ForwardRefExoticComponent<NavigationProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -7,17 +7,17 @@ import { isClientSideNavigation } from "../../../../../../../Links/common/utils"
|
|
|
7
7
|
import { NavigationDrawer } from "./components/NavigationDrawer/navigationDrawer";
|
|
8
8
|
import { NavigationMenu } from "./components/NavigationMenu/navigationMenu";
|
|
9
9
|
import { Navigation as Links } from "./navigation.styles";
|
|
10
|
-
export const Navigation = forwardRef(function Navigation({ className, closeAncestor, headerProps, links, style }, ref) {
|
|
10
|
+
export const Navigation = forwardRef(function Navigation({ className, closeAncestor, headerProps, links, pathname, style, }, ref) {
|
|
11
11
|
const { mdUp } = useBreakpoint();
|
|
12
12
|
const router = useRouter();
|
|
13
13
|
return (React.createElement(Links, { ref: ref, className: className, style: style }, links.map(({ divider, label, menuItems, target = ANCHOR_TARGET.SELF, url }, i) => menuItems ? (React.createElement(Fragment, { key: i },
|
|
14
|
-
mdUp ? (React.createElement(NavigationMenu, { closeAncestor: closeAncestor, menuItems: menuItems, menuLabel: label })) : (React.createElement(NavigationDrawer, { closeAncestor: closeAncestor, headerProps: headerProps, menuItems: menuItems, menuLabel: label })),
|
|
14
|
+
mdUp ? (React.createElement(NavigationMenu, { closeAncestor: closeAncestor, menuItems: menuItems, menuLabel: label, pathname: pathname })) : (React.createElement(NavigationDrawer, { closeAncestor: closeAncestor, headerProps: headerProps, menuItems: menuItems, menuLabel: label, pathname: pathname })),
|
|
15
15
|
divider && React.createElement(Divider, null))) : (React.createElement(Fragment, { key: i },
|
|
16
16
|
React.createElement(Button, { onClick: () => {
|
|
17
17
|
isClientSideNavigation(url)
|
|
18
18
|
? router.push(url)
|
|
19
19
|
: window.open(url, target, "noopener noreferrer");
|
|
20
20
|
closeAncestor?.();
|
|
21
|
-
}, variant: "nav" }, label),
|
|
21
|
+
}, variant: url === pathname ? "activeNav" : "nav" }, label),
|
|
22
22
|
divider && React.createElement(Divider, null))))));
|
|
23
23
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fade, Toolbar } from "@mui/material";
|
|
2
|
+
import { usePathname } from "next/navigation";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { useBreakpoint } from "../../../../hooks/useBreakpoint";
|
|
4
5
|
import { useMenu } from "../../../../hooks/useMenu";
|
|
@@ -21,7 +22,9 @@ export const Header = ({ ...headerProps }) => {
|
|
|
21
22
|
const { isIn } = useHeaderVisibility(headerProps);
|
|
22
23
|
const { headerRef } = useMeasureHeader();
|
|
23
24
|
const { onClose, onOpen, open } = useMenu();
|
|
25
|
+
const pathname = usePathname() ?? "";
|
|
24
26
|
const { actions, announcements, authenticationEnabled, className, logo, navigation: [navItemsL, navItemsC, navItemsR] = [], searchEnabled, searchURL, slogan, socialMedia, } = headerProps;
|
|
27
|
+
const navigationProps = { headerProps, pathname };
|
|
25
28
|
return (React.createElement(AppBar, { ...APP_BAR_PROPS, ref: headerRef, className: className },
|
|
26
29
|
React.createElement(Announcements, { announcements: announcements }),
|
|
27
30
|
React.createElement(Toolbar, { ...TOOLBAR_PROPS },
|
|
@@ -30,16 +33,16 @@ export const Header = ({ ...headerProps }) => {
|
|
|
30
33
|
logo,
|
|
31
34
|
isIn.isSloganIn && React.createElement(Divider, { flexItem: true, orientation: "vertical" }),
|
|
32
35
|
isIn.isSloganIn && React.createElement(Slogan, { slogan: slogan }),
|
|
33
|
-
isIn.isLeftNavigationIn && (React.createElement(DXNavigation, {
|
|
36
|
+
isIn.isLeftNavigationIn && (React.createElement(DXNavigation, { ...navigationProps, links: getNavigationLinks(navItemsL, breakpoint) })))),
|
|
34
37
|
React.createElement(Fade, { ...FADE_TRANSITION_PROPS, in: isIn.isCenterGroupIn },
|
|
35
|
-
React.createElement(Center, null, isIn.isCenterNavigationIn && (React.createElement(DXNavigation, {
|
|
38
|
+
React.createElement(Center, null, isIn.isCenterNavigationIn && (React.createElement(DXNavigation, { ...navigationProps, links: getNavigationLinks(navItemsC, breakpoint) })))),
|
|
36
39
|
React.createElement(Fade, { ...FADE_TRANSITION_PROPS, in: isIn.isRightGroupIn },
|
|
37
40
|
React.createElement(Right, null,
|
|
38
|
-
isIn.isRightNavigationIn && (React.createElement(DXNavigation, {
|
|
41
|
+
isIn.isRightNavigationIn && (React.createElement(DXNavigation, { ...navigationProps, links: getNavigationLinks(navItemsR) })),
|
|
39
42
|
isIn.isSocialsIn && (React.createElement(Socials, { buttonSize: "small", socials: socialMedia?.socials || [] })),
|
|
40
43
|
isIn.isActionsIn && (React.createElement(Actions, null,
|
|
41
44
|
React.createElement(Search, { closeMenu: onClose, searchEnabled: searchEnabled, searchURL: searchURL }),
|
|
42
45
|
React.createElement(Authentication, { authenticationEnabled: authenticationEnabled, closeMenu: onClose }),
|
|
43
46
|
actions,
|
|
44
|
-
React.createElement(Menu, { closeMenu: onClose,
|
|
47
|
+
React.createElement(Menu, { ...navigationProps, closeMenu: onClose, open: open, openMenu: onOpen }))))))));
|
|
45
48
|
};
|
|
@@ -383,6 +383,23 @@ export const MuiButton = (theme) => {
|
|
|
383
383
|
},
|
|
384
384
|
},
|
|
385
385
|
variants: [
|
|
386
|
+
{
|
|
387
|
+
props: {
|
|
388
|
+
variant: "activeNav", // associated with "nav" variant.
|
|
389
|
+
},
|
|
390
|
+
style: {
|
|
391
|
+
...theme.typography[TEXT_BODY_500],
|
|
392
|
+
backgroundColor: theme.palette.smoke.light,
|
|
393
|
+
color: theme.palette.ink.main,
|
|
394
|
+
minWidth: 0,
|
|
395
|
+
textTransform: "capitalize",
|
|
396
|
+
whiteSpace: "nowrap",
|
|
397
|
+
// eslint-disable-next-line sort-keys -- disabling key order for readability
|
|
398
|
+
"&:hover": {
|
|
399
|
+
backgroundColor: theme.palette.smoke.light,
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
},
|
|
386
403
|
{
|
|
387
404
|
props: {
|
|
388
405
|
variant: "nav",
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ export const Navigation = styled(DXNavigation)`
|
|
|
13
13
|
margin: 0;
|
|
14
14
|
justify-content: flex-start;
|
|
15
15
|
|
|
16
|
+
.MuiButton-activeNav,
|
|
16
17
|
.MuiButton-nav {
|
|
17
18
|
${textBodyLarge500};
|
|
18
19
|
justify-content: space-between;
|
|
@@ -27,6 +28,7 @@ export const Navigation = styled(DXNavigation)`
|
|
|
27
28
|
export const DrawerNavigation = styled(Navigation)`
|
|
28
29
|
gap: 0;
|
|
29
30
|
|
|
31
|
+
.MuiButton-activeNav,
|
|
30
32
|
.MuiButton-nav {
|
|
31
33
|
${textBody500};
|
|
32
34
|
padding: 14px 24px;
|
|
@@ -16,12 +16,13 @@ export interface MenuProps {
|
|
|
16
16
|
headerProps: HeaderProps;
|
|
17
17
|
open: boolean;
|
|
18
18
|
openMenu: () => void;
|
|
19
|
+
pathname?: string;
|
|
19
20
|
style?: CSSProperties; // Required for Fade component. See https://mui.com/material-ui/transitions/#child-requirement.
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export const Menu = forwardRef<HTMLButtonElement, MenuProps>(
|
|
23
24
|
function HeaderMenu(
|
|
24
|
-
{ closeMenu, headerProps, open, openMenu, style }: MenuProps,
|
|
25
|
+
{ closeMenu, headerProps, open, openMenu, pathname, style }: MenuProps,
|
|
25
26
|
ref
|
|
26
27
|
): JSX.Element | null {
|
|
27
28
|
const { navigation, slogan, socialMedia } = headerProps;
|
|
@@ -61,6 +62,7 @@ export const Menu = forwardRef<HTMLButtonElement, MenuProps>(
|
|
|
61
62
|
closeAncestor={closeMenu}
|
|
62
63
|
headerProps={headerProps}
|
|
63
64
|
links={getMenuNavigationLinks(navigation, breakpoint)}
|
|
65
|
+
pathname={pathname}
|
|
64
66
|
/>
|
|
65
67
|
{socialMedia && (
|
|
66
68
|
<Socials buttonSize="xlarge" socials={socialMedia.socials} />
|
|
@@ -16,6 +16,7 @@ export interface NavigationDrawerProps {
|
|
|
16
16
|
headerProps?: HeaderProps;
|
|
17
17
|
menuItems: MenuItem[];
|
|
18
18
|
menuLabel: ReactNode;
|
|
19
|
+
pathname?: string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export const NavigationDrawer = ({
|
|
@@ -23,6 +24,7 @@ export const NavigationDrawer = ({
|
|
|
23
24
|
headerProps,
|
|
24
25
|
menuItems,
|
|
25
26
|
menuLabel,
|
|
27
|
+
pathname,
|
|
26
28
|
}: NavigationDrawerProps): JSX.Element => {
|
|
27
29
|
const [drawerOpen, setDrawerOpen] = useState<boolean>(false);
|
|
28
30
|
const openDrawer = (): void => {
|
|
@@ -71,6 +73,7 @@ export const NavigationDrawer = ({
|
|
|
71
73
|
closeAncestor={closeDrawers}
|
|
72
74
|
headerProps={headerProps}
|
|
73
75
|
links={menuItems}
|
|
76
|
+
pathname={pathname}
|
|
74
77
|
/>
|
|
75
78
|
</Content>
|
|
76
79
|
</MDialog>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { css } from "@emotion/react";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
3
|
import { Menu as MMenu } from "@mui/material";
|
|
4
|
+
import {
|
|
5
|
+
inkLight,
|
|
6
|
+
smokeLight,
|
|
7
|
+
smokeMain,
|
|
8
|
+
} from "../../../../../../../../../../styles/common/mixins/colors";
|
|
4
9
|
import { Button as DXButton } from "../../../../../../../../../common/Button/button";
|
|
5
10
|
|
|
6
11
|
interface Props {
|
|
@@ -9,7 +14,7 @@ interface Props {
|
|
|
9
14
|
|
|
10
15
|
export const Menu = styled(MMenu)`
|
|
11
16
|
.MuiPaper-menu {
|
|
12
|
-
border-color: ${
|
|
17
|
+
border-color: ${smokeMain};
|
|
13
18
|
margin: 4px 0;
|
|
14
19
|
max-width: 324px;
|
|
15
20
|
min-width: 204px;
|
|
@@ -36,12 +41,17 @@ export const Menu = styled(MMenu)`
|
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
.MuiListItemText-secondary {
|
|
39
|
-
color: ${
|
|
44
|
+
color: ${inkLight};
|
|
40
45
|
white-space: normal;
|
|
41
46
|
}
|
|
42
47
|
}
|
|
48
|
+
|
|
49
|
+
&.Mui-selected {
|
|
50
|
+
background-color: ${smokeLight};
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
|
|
54
|
+
.MuiButton-activeNav,
|
|
45
55
|
.MuiButton-nav {
|
|
46
56
|
font-weight: 400;
|
|
47
57
|
justify-content: space-between;
|
|
@@ -63,9 +73,9 @@ export const Button = styled(DXButton, {
|
|
|
63
73
|
shouldForwardProp: (prop) => prop !== "isActive",
|
|
64
74
|
})<Props>`
|
|
65
75
|
// Button is "active" i.e. menu is open.
|
|
66
|
-
${(
|
|
67
|
-
isActive &&
|
|
76
|
+
${(props) =>
|
|
77
|
+
props.isActive &&
|
|
68
78
|
css`
|
|
69
|
-
background-color: ${
|
|
79
|
+
background-color: ${smokeLight(props)};
|
|
70
80
|
`};
|
|
71
81
|
`;
|
|
@@ -13,6 +13,7 @@ export interface NavLinkMenuProps {
|
|
|
13
13
|
closeAncestor?: () => void;
|
|
14
14
|
menuItems: MenuItem[];
|
|
15
15
|
menuLabel: ReactNode;
|
|
16
|
+
pathname?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export const NavigationMenu = ({
|
|
@@ -20,6 +21,7 @@ export const NavigationMenu = ({
|
|
|
20
21
|
closeAncestor,
|
|
21
22
|
menuItems,
|
|
22
23
|
menuLabel,
|
|
24
|
+
pathname,
|
|
23
25
|
}: NavLinkMenuProps): JSX.Element => {
|
|
24
26
|
const { mdUp } = useBreakpoint();
|
|
25
27
|
const [anchorEl, setAnchorEl] = useState<null | HTMLButtonElement>(null);
|
|
@@ -52,7 +54,11 @@ export const NavigationMenu = ({
|
|
|
52
54
|
vertical: "top",
|
|
53
55
|
}}
|
|
54
56
|
>
|
|
55
|
-
<NavigationMenuItems
|
|
57
|
+
<NavigationMenuItems
|
|
58
|
+
closeMenu={closeMenu}
|
|
59
|
+
menuItems={menuItems}
|
|
60
|
+
pathname={pathname}
|
|
61
|
+
/>
|
|
56
62
|
</Menu>
|
|
57
63
|
</>
|
|
58
64
|
);
|
|
@@ -24,11 +24,13 @@ export interface MenuItem extends NavLinkItem {
|
|
|
24
24
|
export interface NavLinkMenuProps {
|
|
25
25
|
closeMenu: () => void;
|
|
26
26
|
menuItems: MenuItem[];
|
|
27
|
+
pathname?: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const NavigationMenuItems = ({
|
|
30
31
|
closeMenu,
|
|
31
32
|
menuItems,
|
|
33
|
+
pathname,
|
|
32
34
|
}: NavLinkMenuProps): JSX.Element => {
|
|
33
35
|
const router = useRouter();
|
|
34
36
|
return (
|
|
@@ -53,6 +55,7 @@ export const NavigationMenuItems = ({
|
|
|
53
55
|
closeAncestor={closeMenu}
|
|
54
56
|
menuItems={nestedMenuItems}
|
|
55
57
|
menuLabel={label}
|
|
58
|
+
pathname={pathname}
|
|
56
59
|
/>
|
|
57
60
|
) : (
|
|
58
61
|
<Fragment key={i}>
|
|
@@ -63,6 +66,7 @@ export const NavigationMenuItems = ({
|
|
|
63
66
|
? router.push(url)
|
|
64
67
|
: window.open(url, target, "noopener noreferrer");
|
|
65
68
|
}}
|
|
69
|
+
selected={url === pathname}
|
|
66
70
|
>
|
|
67
71
|
{icon && <ListItemIcon>{icon}</ListItemIcon>}
|
|
68
72
|
<ListItemText
|
|
@@ -26,12 +26,20 @@ export interface NavigationProps {
|
|
|
26
26
|
closeAncestor?: () => void;
|
|
27
27
|
headerProps?: HeaderProps;
|
|
28
28
|
links: NavLinkItem[];
|
|
29
|
+
pathname?: string;
|
|
29
30
|
style?: CSSProperties; // Required for Fade component. See https://mui.com/material-ui/transitions/#child-requirement.
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export const Navigation = forwardRef<HTMLDivElement, NavigationProps>(
|
|
33
34
|
function Navigation(
|
|
34
|
-
{
|
|
35
|
+
{
|
|
36
|
+
className,
|
|
37
|
+
closeAncestor,
|
|
38
|
+
headerProps,
|
|
39
|
+
links,
|
|
40
|
+
pathname,
|
|
41
|
+
style,
|
|
42
|
+
}: NavigationProps,
|
|
35
43
|
ref
|
|
36
44
|
): JSX.Element {
|
|
37
45
|
const { mdUp } = useBreakpoint();
|
|
@@ -50,6 +58,7 @@ export const Navigation = forwardRef<HTMLDivElement, NavigationProps>(
|
|
|
50
58
|
closeAncestor={closeAncestor}
|
|
51
59
|
menuItems={menuItems}
|
|
52
60
|
menuLabel={label}
|
|
61
|
+
pathname={pathname}
|
|
53
62
|
/>
|
|
54
63
|
) : (
|
|
55
64
|
<NavigationDrawer
|
|
@@ -57,6 +66,7 @@ export const Navigation = forwardRef<HTMLDivElement, NavigationProps>(
|
|
|
57
66
|
headerProps={headerProps}
|
|
58
67
|
menuItems={menuItems}
|
|
59
68
|
menuLabel={label}
|
|
69
|
+
pathname={pathname}
|
|
60
70
|
/>
|
|
61
71
|
)}
|
|
62
72
|
{divider && <Divider />}
|
|
@@ -70,7 +80,7 @@ export const Navigation = forwardRef<HTMLDivElement, NavigationProps>(
|
|
|
70
80
|
: window.open(url, target, "noopener noreferrer");
|
|
71
81
|
closeAncestor?.();
|
|
72
82
|
}}
|
|
73
|
-
variant="nav"
|
|
83
|
+
variant={url === pathname ? "activeNav" : "nav"}
|
|
74
84
|
>
|
|
75
85
|
{label}
|
|
76
86
|
</Button>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fade, Toolbar } from "@mui/material";
|
|
2
|
+
import { usePathname } from "next/navigation";
|
|
2
3
|
import React, { ReactNode } from "react";
|
|
3
4
|
import { ComponentsConfig } from "../../../../config/entities";
|
|
4
5
|
import { useBreakpoint } from "../../../../hooks/useBreakpoint";
|
|
@@ -41,6 +42,7 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
|
|
|
41
42
|
const { isIn } = useHeaderVisibility(headerProps);
|
|
42
43
|
const { headerRef } = useMeasureHeader();
|
|
43
44
|
const { onClose, onOpen, open } = useMenu();
|
|
45
|
+
const pathname = usePathname() ?? "";
|
|
44
46
|
const {
|
|
45
47
|
actions,
|
|
46
48
|
announcements,
|
|
@@ -53,6 +55,7 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
|
|
|
53
55
|
slogan,
|
|
54
56
|
socialMedia,
|
|
55
57
|
} = headerProps;
|
|
58
|
+
const navigationProps = { headerProps, pathname };
|
|
56
59
|
|
|
57
60
|
return (
|
|
58
61
|
<AppBar {...APP_BAR_PROPS} ref={headerRef} className={className}>
|
|
@@ -72,7 +75,7 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
|
|
|
72
75
|
{/* Left navigation */}
|
|
73
76
|
{isIn.isLeftNavigationIn && (
|
|
74
77
|
<DXNavigation
|
|
75
|
-
|
|
78
|
+
{...navigationProps}
|
|
76
79
|
links={getNavigationLinks(navItemsL, breakpoint)}
|
|
77
80
|
/>
|
|
78
81
|
)}
|
|
@@ -84,7 +87,7 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
|
|
|
84
87
|
{/* Center navigation */}
|
|
85
88
|
{isIn.isCenterNavigationIn && (
|
|
86
89
|
<DXNavigation
|
|
87
|
-
|
|
90
|
+
{...navigationProps}
|
|
88
91
|
links={getNavigationLinks(navItemsC, breakpoint)}
|
|
89
92
|
/>
|
|
90
93
|
)}
|
|
@@ -96,7 +99,7 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
|
|
|
96
99
|
{/* Navigation */}
|
|
97
100
|
{isIn.isRightNavigationIn && (
|
|
98
101
|
<DXNavigation
|
|
99
|
-
|
|
102
|
+
{...navigationProps}
|
|
100
103
|
links={getNavigationLinks(navItemsR)}
|
|
101
104
|
/>
|
|
102
105
|
)}
|
|
@@ -125,8 +128,8 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
|
|
|
125
128
|
{actions}
|
|
126
129
|
{/* Menu */}
|
|
127
130
|
<Menu
|
|
131
|
+
{...navigationProps}
|
|
128
132
|
closeMenu={onClose}
|
|
129
|
-
headerProps={headerProps}
|
|
130
133
|
open={open}
|
|
131
134
|
openMenu={onOpen}
|
|
132
135
|
/>
|
|
@@ -410,6 +410,23 @@ export const MuiButton = (theme: Theme): Components["MuiButton"] => {
|
|
|
410
410
|
},
|
|
411
411
|
},
|
|
412
412
|
variants: [
|
|
413
|
+
{
|
|
414
|
+
props: {
|
|
415
|
+
variant: "activeNav", // associated with "nav" variant.
|
|
416
|
+
},
|
|
417
|
+
style: {
|
|
418
|
+
...theme.typography[TEXT_BODY_500],
|
|
419
|
+
backgroundColor: theme.palette.smoke.light,
|
|
420
|
+
color: theme.palette.ink.main,
|
|
421
|
+
minWidth: 0,
|
|
422
|
+
textTransform: "capitalize",
|
|
423
|
+
whiteSpace: "nowrap",
|
|
424
|
+
// eslint-disable-next-line sort-keys -- disabling key order for readability
|
|
425
|
+
"&:hover": {
|
|
426
|
+
backgroundColor: theme.palette.smoke.light,
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
},
|
|
413
430
|
{
|
|
414
431
|
props: {
|
|
415
432
|
variant: "nav",
|