@databiosphere/findable-ui 10.0.0 → 10.1.0
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/package.json +1 -1
- package/src/components/Filter/components/Filter/filter.styles.ts +2 -1
- package/src/components/Filter/components/Filter/filter.tsx +1 -0
- package/src/components/Filter/components/FilterLabel/filterLabel.stories.tsx +2 -0
- package/src/components/Filter/components/FilterLabel/filterLabel.styles.ts +25 -5
- package/src/components/Filter/components/FilterLabel/filterLabel.tsx +3 -0
- package/src/components/Filter/components/FilterTags/filterTags.styles.ts +2 -7
- package/src/components/Filter/components/Filters/filters.styles.ts +10 -17
- package/src/components/Filter/components/Filters/filters.tsx +2 -20
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.tsx +50 -12
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.ts +8 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/common/constants.ts +9 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.tsx +10 -2
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.tsx +17 -13
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.ts +8 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/search.tsx +41 -6
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/common/constants.ts +9 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.tsx +5 -6
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.ts +12 -20
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.ts +48 -46
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +62 -33
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/common/constants.ts +5 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.tsx +4 -3
- package/src/components/Layout/components/Header/components/Content/components/Navigation/navigation.styles.ts +14 -12
- package/src/components/Layout/components/Header/components/Content/components/Navigation/navigation.tsx +8 -7
- package/src/components/Layout/components/Header/header.styles.ts +2 -1
- package/src/components/Layout/components/Header/header.tsx +21 -2
- package/src/components/Layout/components/Header/hooks/useHeaderVisibility.ts +11 -6
- package/src/components/common/CustomIcon/components/InProgressIcon/inProgressIcon.tsx +22 -0
- package/src/components/common/Menu/hooks/useMenu.ts +17 -3
- package/src/hooks/useBreakpoint.ts +9 -8
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.ts +0 -10
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.tsx +0 -36
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.ts +0 -10
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.tsx +0 -22
package/package.json
CHANGED
|
@@ -6,13 +6,14 @@ import { IconButton as DXIconButton } from "../../../common/IconButton/iconButto
|
|
|
6
6
|
|
|
7
7
|
export const FilterPopover = styled(Popover)`
|
|
8
8
|
.MuiPaper-menu {
|
|
9
|
-
margin: 0;
|
|
9
|
+
margin: 4px 0;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
${mediaDesktopSmallDown} {
|
|
13
13
|
.MuiPaper-root {
|
|
14
14
|
background-color: ${smokeLight};
|
|
15
15
|
height: 100%;
|
|
16
|
+
margin: 0;
|
|
16
17
|
max-height: 100%;
|
|
17
18
|
overflow: visible; // required; allows backdrop button to render outside of drawer container.
|
|
18
19
|
}
|
|
@@ -6,6 +6,7 @@ export default {
|
|
|
6
6
|
argTypes: {
|
|
7
7
|
count: { control: "number" },
|
|
8
8
|
disabled: { control: "boolean" },
|
|
9
|
+
isOpen: { control: "boolean" },
|
|
9
10
|
label: { control: "text" },
|
|
10
11
|
},
|
|
11
12
|
component: FilterLabel,
|
|
@@ -27,5 +28,6 @@ export const FilterLabelStory = FilterLabelTemplate.bind({});
|
|
|
27
28
|
FilterLabelStory.args = {
|
|
28
29
|
count: 123,
|
|
29
30
|
disabled: false,
|
|
31
|
+
isOpen: false,
|
|
30
32
|
label: "Label",
|
|
31
33
|
};
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
3
|
import { Button } from "@mui/material";
|
|
3
4
|
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
5
|
+
import { inkLight, smokeMain } from "../../../../styles/common/mixins/colors";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
interface Props {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const FilterLabel = styled(Button, {
|
|
12
|
+
shouldForwardProp: (prop) => prop !== "isOpen",
|
|
13
|
+
})<Props>`
|
|
6
14
|
font-weight: inherit;
|
|
7
15
|
gap: 0;
|
|
8
16
|
justify-content: space-between;
|
|
9
|
-
padding: 10px
|
|
17
|
+
padding: 10px 8px;
|
|
10
18
|
text-transform: none;
|
|
11
19
|
text-align: left;
|
|
12
20
|
|
|
13
21
|
:hover {
|
|
14
|
-
background-color:
|
|
22
|
+
background-color: ${smokeMain};
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
&.Mui-disabled {
|
|
@@ -19,16 +27,28 @@ export const FilterLabel = styled(Button)`
|
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
& .MuiButton-endIcon {
|
|
30
|
+
color: ${inkLight};
|
|
22
31
|
margin-right: -4px;
|
|
23
32
|
transform: rotate(-90deg);
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
${mediaDesktopSmallUp} {
|
|
27
|
-
padding: 6px
|
|
36
|
+
padding: 6px 8px;
|
|
28
37
|
|
|
29
38
|
& .MuiButton-endIcon {
|
|
30
|
-
margin-right: 0;
|
|
31
39
|
transform: unset;
|
|
32
40
|
}
|
|
33
41
|
}
|
|
42
|
+
|
|
43
|
+
${(props) =>
|
|
44
|
+
props.isOpen &&
|
|
45
|
+
css`
|
|
46
|
+
background-color: ${smokeMain(props)};
|
|
47
|
+
|
|
48
|
+
${mediaDesktopSmallUp(props)} {
|
|
49
|
+
& .MuiButton-endIcon {
|
|
50
|
+
transform: rotate(180deg);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`};
|
|
34
54
|
`;
|
|
@@ -5,6 +5,7 @@ import { FilterLabel as Label } from "./filterLabel.styles";
|
|
|
5
5
|
export interface FilterLabelProps {
|
|
6
6
|
count?: number;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
+
isOpen: boolean;
|
|
8
9
|
label: string;
|
|
9
10
|
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
10
11
|
}
|
|
@@ -12,6 +13,7 @@ export interface FilterLabelProps {
|
|
|
12
13
|
export const FilterLabel = ({
|
|
13
14
|
count,
|
|
14
15
|
disabled = false,
|
|
16
|
+
isOpen,
|
|
15
17
|
label,
|
|
16
18
|
onClick,
|
|
17
19
|
}: FilterLabelProps): JSX.Element => {
|
|
@@ -22,6 +24,7 @@ export const FilterLabel = ({
|
|
|
22
24
|
disabled={disabled}
|
|
23
25
|
endIcon={<ArrowDropDownRoundedIcon fontSize="small" />}
|
|
24
26
|
fullWidth
|
|
27
|
+
isOpen={isOpen}
|
|
25
28
|
onClick={onClick}
|
|
26
29
|
>
|
|
27
30
|
{filterLabel}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
|
-
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
3
2
|
|
|
4
3
|
export const FilterTags = styled.span`
|
|
5
4
|
display: flex;
|
|
6
5
|
flex-wrap: wrap;
|
|
7
6
|
gap: 4px;
|
|
8
|
-
margin
|
|
9
|
-
padding: 0
|
|
7
|
+
margin: 4px 0 8px;
|
|
8
|
+
padding: 0 8px;
|
|
10
9
|
|
|
11
10
|
&:last-child {
|
|
12
11
|
margin-bottom: 0;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
${mediaDesktopSmallUp} {
|
|
16
|
-
padding: 0;
|
|
17
|
-
}
|
|
18
13
|
`;
|
|
@@ -3,25 +3,22 @@ import styled from "@emotion/styled";
|
|
|
3
3
|
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
4
4
|
import { inkLight, inkMain } from "../../../../styles/common/mixins/colors";
|
|
5
5
|
import {
|
|
6
|
-
textBody400,
|
|
7
6
|
textBody500,
|
|
7
|
+
textUppercase500,
|
|
8
8
|
} from "../../../../styles/common/mixins/fonts";
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
disabled: boolean;
|
|
12
12
|
height: number;
|
|
13
|
-
isBaseStyle: boolean;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export const Filters = styled("div"
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
${(props) => (props.isBaseStyle ? textBody500(props) : textBody400(props))};
|
|
20
|
-
color: ${(props) => (props.isBaseStyle ? inkMain(props) : inkLight(props))};
|
|
15
|
+
export const Filters = styled("div")<Props>`
|
|
16
|
+
${textBody500};
|
|
17
|
+
color: ${inkMain};
|
|
21
18
|
height: ${({ height }) => height}px;
|
|
22
19
|
margin: 8px 0;
|
|
23
20
|
overflow: auto;
|
|
24
|
-
padding: 0
|
|
21
|
+
padding: 0 8px 8px;
|
|
25
22
|
|
|
26
23
|
// Filters are globally "disabled".
|
|
27
24
|
${({ disabled }) =>
|
|
@@ -31,22 +28,18 @@ export const Filters = styled("div", {
|
|
|
31
28
|
`};
|
|
32
29
|
|
|
33
30
|
.MuiDivider-root {
|
|
34
|
-
margin: 8px
|
|
31
|
+
margin: 8px;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
${mediaDesktopSmallUp} {
|
|
38
35
|
height: unset;
|
|
39
36
|
overflow: unset;
|
|
40
|
-
padding: 0
|
|
37
|
+
padding: 0 8px;
|
|
41
38
|
}
|
|
42
39
|
`;
|
|
43
40
|
|
|
44
41
|
export const CategoryViewsLabel = styled("div")`
|
|
45
|
-
${
|
|
46
|
-
color: ${
|
|
47
|
-
padding: 8px
|
|
48
|
-
|
|
49
|
-
${mediaDesktopSmallUp} {
|
|
50
|
-
padding: 8px 0;
|
|
51
|
-
}
|
|
42
|
+
${textUppercase500};
|
|
43
|
+
color: ${inkLight};
|
|
44
|
+
padding: 8px;
|
|
52
45
|
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Divider } from "@mui/material";
|
|
2
|
-
import React, { Fragment, useEffect,
|
|
2
|
+
import React, { Fragment, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { CategoryTag, SelectCategoryView } from "../../../../common/entities";
|
|
4
4
|
import { TrackFilterOpenedFunction } from "../../../../config/entities";
|
|
5
5
|
import {
|
|
@@ -76,22 +76,13 @@ export const Filters = ({
|
|
|
76
76
|
const { height: windowHeight } = useWindowResize();
|
|
77
77
|
const filterListRef = useRef<HTMLDivElement>(null);
|
|
78
78
|
const [height, setHeight] = useState<number>(0);
|
|
79
|
-
const isLabeled = useMemo(
|
|
80
|
-
() => isCategoryViewsLabeled(categoryFilters),
|
|
81
|
-
[categoryFilters]
|
|
82
|
-
);
|
|
83
79
|
|
|
84
80
|
useEffect(() => {
|
|
85
81
|
setHeight(calculateListHeight(windowHeight, filterListRef.current));
|
|
86
82
|
}, [windowHeight]);
|
|
87
83
|
|
|
88
84
|
return (
|
|
89
|
-
<FilterList
|
|
90
|
-
disabled={disabled}
|
|
91
|
-
height={height}
|
|
92
|
-
isBaseStyle={!isLabeled}
|
|
93
|
-
ref={filterListRef}
|
|
94
|
-
>
|
|
85
|
+
<FilterList disabled={disabled} height={height} ref={filterListRef}>
|
|
95
86
|
{categoryFilters.map(({ categoryViews, label }, i) => (
|
|
96
87
|
<Fragment key={i}>
|
|
97
88
|
{i !== 0 && <Divider />}
|
|
@@ -126,12 +117,3 @@ function calculateListHeight(
|
|
|
126
117
|
): number {
|
|
127
118
|
return windowHeight - (filterListEl?.getBoundingClientRect()?.top ?? 0);
|
|
128
119
|
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Returns true if any category views are labelled.
|
|
132
|
-
* @param categoryFilters - Category filters.
|
|
133
|
-
* @returns true if any category views are labelled.
|
|
134
|
-
*/
|
|
135
|
-
function isCategoryViewsLabeled(categoryFilters: CategoryFilter[]): boolean {
|
|
136
|
-
return categoryFilters.some(({ label }) => label);
|
|
137
|
-
}
|
|
@@ -1,35 +1,73 @@
|
|
|
1
|
+
import LoginRoundedIcon from "@mui/icons-material/LoginRounded";
|
|
2
|
+
import {
|
|
3
|
+
ButtonProps as MButtonProps,
|
|
4
|
+
IconButton as MIconButton,
|
|
5
|
+
IconButtonProps as MIconButtonProps,
|
|
6
|
+
} from "@mui/material";
|
|
1
7
|
import { useRouter } from "next/router";
|
|
2
|
-
import React, { useCallback } from "react";
|
|
8
|
+
import React, { ElementType, useCallback } from "react";
|
|
3
9
|
import { useAuthentication } from "../../../../../../../../../../hooks/useAuthentication/useAuthentication";
|
|
4
10
|
import { AuthenticationMenu } from "./components/AuthenticationMenu/authenticationMenu";
|
|
5
|
-
import {
|
|
11
|
+
import { StyledButton } from "./components/Button/button.styles";
|
|
6
12
|
|
|
7
13
|
export interface AuthenticationProps {
|
|
8
14
|
authenticationEnabled?: boolean;
|
|
15
|
+
Button: ElementType<MButtonProps> | ElementType<MIconButtonProps>;
|
|
9
16
|
closeMenu: () => void;
|
|
10
17
|
}
|
|
11
18
|
|
|
12
19
|
export const Authentication = ({
|
|
13
20
|
authenticationEnabled,
|
|
21
|
+
Button,
|
|
14
22
|
closeMenu,
|
|
15
|
-
}: AuthenticationProps): JSX.Element => {
|
|
23
|
+
}: AuthenticationProps): JSX.Element | null => {
|
|
16
24
|
const { isAuthenticated, requestAuthentication, userProfile } =
|
|
17
25
|
useAuthentication();
|
|
18
26
|
const router = useRouter();
|
|
19
27
|
const onLogout = useCallback((): void => {
|
|
20
28
|
location.href = router.basePath;
|
|
21
29
|
}, [router]);
|
|
30
|
+
|
|
31
|
+
if (!authenticationEnabled) return null;
|
|
32
|
+
|
|
22
33
|
return (
|
|
23
34
|
<>
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
{isAuthenticated && userProfile ? (
|
|
36
|
+
<AuthenticationMenu onLogout={onLogout} userProfile={userProfile} />
|
|
37
|
+
) : (
|
|
38
|
+
<Button
|
|
39
|
+
onClick={(): void => {
|
|
40
|
+
requestAuthentication();
|
|
41
|
+
closeMenu();
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
)}
|
|
33
45
|
</>
|
|
34
46
|
);
|
|
35
47
|
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Renders authentication button.
|
|
51
|
+
* @param props - Button props.
|
|
52
|
+
* @returns button.
|
|
53
|
+
*/
|
|
54
|
+
export function renderButton(props: MButtonProps): JSX.Element {
|
|
55
|
+
return (
|
|
56
|
+
<StyledButton startIcon={<LoginRoundedIcon />} variant="nav" {...props}>
|
|
57
|
+
Sign in
|
|
58
|
+
</StyledButton>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Renders authentication icon button.
|
|
64
|
+
* @param props - Button props.
|
|
65
|
+
* @returns icon button.
|
|
66
|
+
*/
|
|
67
|
+
export function renderIconButton(props: MIconButtonProps): JSX.Element {
|
|
68
|
+
return (
|
|
69
|
+
<MIconButton color="ink" {...props}>
|
|
70
|
+
<LoginRoundedIcon />
|
|
71
|
+
</MIconButton>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -5,8 +5,14 @@ import { ComponentsConfig } from "../../../../../../../../../../../../config/ent
|
|
|
5
5
|
import { Left, Right } from "../../../../../../../../header.styles";
|
|
6
6
|
import { Announcements } from "../../../../../../../Announcements/announcements";
|
|
7
7
|
import { Actions } from "../../../../actions";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
Authentication,
|
|
10
|
+
renderIconButton as renderAuthenticationIconButton,
|
|
11
|
+
} from "../../../Authentication/authentication";
|
|
12
|
+
import {
|
|
13
|
+
renderIconButton as renderSearchIconButton,
|
|
14
|
+
Search,
|
|
15
|
+
} from "../../../Search/search";
|
|
10
16
|
|
|
11
17
|
export interface DialogTitleProps {
|
|
12
18
|
actions?: ReactNode;
|
|
@@ -36,6 +42,7 @@ export const Toolbar = ({
|
|
|
36
42
|
<Actions>
|
|
37
43
|
{/* Search */}
|
|
38
44
|
<Search
|
|
45
|
+
Button={renderSearchIconButton}
|
|
39
46
|
closeMenu={onClose}
|
|
40
47
|
searchEnabled={searchEnabled}
|
|
41
48
|
searchURL={searchURL}
|
|
@@ -43,6 +50,7 @@ export const Toolbar = ({
|
|
|
43
50
|
{/* Authentication */}
|
|
44
51
|
<Authentication
|
|
45
52
|
authenticationEnabled={authenticationEnabled}
|
|
53
|
+
Button={renderAuthenticationIconButton}
|
|
46
54
|
closeMenu={onClose}
|
|
47
55
|
/>
|
|
48
56
|
{/* Additional actions i.e. call-to-action button */}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import MenuRoundedIcon from "@mui/icons-material/MenuRounded";
|
|
2
2
|
import { Dialog as MDialog, Fade, IconButton } from "@mui/material";
|
|
3
3
|
import React, { CSSProperties, forwardRef, Fragment, useEffect } from "react";
|
|
4
|
-
import { useBreakpoint } from "../../../../../../../../../../hooks/useBreakpoint";
|
|
5
4
|
import { getMenuNavigationLinks } from "../../../../../../common/utils";
|
|
6
5
|
import { HeaderProps } from "../../../../../../header";
|
|
7
6
|
import { AppBar } from "../../../../../../header.styles";
|
|
8
7
|
import { Content } from "../../../../content.styles";
|
|
9
8
|
import { Slogan } from "../../../Slogan/slogan";
|
|
9
|
+
import { DIALOG_PROPS } from "./common/constants";
|
|
10
10
|
import { Navigation } from "./components/Content/components/Navigation/navigation.styles";
|
|
11
11
|
import { Socials } from "./components/Content/components/Socials/socials.styles";
|
|
12
12
|
import { Toolbar } from "./components/Toolbar/toolbar";
|
|
@@ -14,6 +14,7 @@ import { Toolbar } from "./components/Toolbar/toolbar";
|
|
|
14
14
|
export interface MenuProps {
|
|
15
15
|
closeMenu: () => void;
|
|
16
16
|
headerProps: HeaderProps;
|
|
17
|
+
isMenuIn: boolean;
|
|
17
18
|
open: boolean;
|
|
18
19
|
openMenu: () => void;
|
|
19
20
|
pathname?: string;
|
|
@@ -22,19 +23,26 @@ export interface MenuProps {
|
|
|
22
23
|
|
|
23
24
|
export const Menu = forwardRef<HTMLButtonElement, MenuProps>(
|
|
24
25
|
function HeaderMenu(
|
|
25
|
-
{
|
|
26
|
+
{
|
|
27
|
+
closeMenu,
|
|
28
|
+
headerProps,
|
|
29
|
+
isMenuIn,
|
|
30
|
+
open,
|
|
31
|
+
openMenu,
|
|
32
|
+
pathname,
|
|
33
|
+
style,
|
|
34
|
+
}: MenuProps,
|
|
26
35
|
ref
|
|
27
36
|
): JSX.Element | null {
|
|
28
37
|
const { navigation, slogan, socialMedia } = headerProps;
|
|
29
|
-
const { smDown } = useBreakpoint();
|
|
30
38
|
|
|
31
39
|
// Set drawer open state to false on change of media breakpoint from small desktop "md" and up.
|
|
32
40
|
useEffect(() => {
|
|
33
|
-
if (
|
|
41
|
+
if (isMenuIn) return;
|
|
34
42
|
closeMenu();
|
|
35
|
-
}, [closeMenu,
|
|
43
|
+
}, [closeMenu, isMenuIn]);
|
|
36
44
|
|
|
37
|
-
if (!
|
|
45
|
+
if (!isMenuIn) return null;
|
|
38
46
|
|
|
39
47
|
return (
|
|
40
48
|
<Fragment>
|
|
@@ -42,16 +50,11 @@ export const Menu = forwardRef<HTMLButtonElement, MenuProps>(
|
|
|
42
50
|
<MenuRoundedIcon />
|
|
43
51
|
</IconButton>
|
|
44
52
|
<MDialog
|
|
45
|
-
|
|
46
|
-
fullScreen
|
|
47
|
-
hideBackdrop
|
|
48
|
-
keepMounted={false}
|
|
53
|
+
{...DIALOG_PROPS}
|
|
49
54
|
onClose={closeMenu}
|
|
50
55
|
open={open}
|
|
51
|
-
PaperProps={{ elevation: 0 }}
|
|
52
56
|
TransitionComponent={Fade}
|
|
53
|
-
transitionDuration={
|
|
54
|
-
TransitionProps={{ easing: "ease-out" }}
|
|
57
|
+
transitionDuration={isMenuIn ? 600 : 0}
|
|
55
58
|
>
|
|
56
59
|
<AppBar component="div" elevation={0}>
|
|
57
60
|
<Toolbar onClose={closeMenu} {...headerProps} />
|
|
@@ -61,6 +64,7 @@ export const Menu = forwardRef<HTMLButtonElement, MenuProps>(
|
|
|
61
64
|
<Navigation
|
|
62
65
|
closeAncestor={closeMenu}
|
|
63
66
|
headerProps={headerProps}
|
|
67
|
+
isMenuIn={isMenuIn}
|
|
64
68
|
links={getMenuNavigationLinks(navigation)}
|
|
65
69
|
pathname={pathname}
|
|
66
70
|
/>
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
ButtonProps as MButtonProps,
|
|
3
|
+
IconButton as MIconButton,
|
|
4
|
+
IconButtonProps as MIconButtonProps,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
import React, { ElementType, useState } from "react";
|
|
7
|
+
import { SearchIcon } from "../../../../../../../../../common/CustomIcon/components/SearchIcon/searchIcon";
|
|
8
|
+
import { StyledButton } from "./components/Button/button.styles";
|
|
2
9
|
import SearchBar from "./components/SearchBar/searchBar";
|
|
3
|
-
import { SearchButton } from "./components/SearchButton/searchButton";
|
|
4
10
|
|
|
5
11
|
export interface SearchProps {
|
|
12
|
+
Button: ElementType<MButtonProps> | ElementType<MIconButtonProps>;
|
|
6
13
|
closeMenu: () => void;
|
|
7
14
|
searchEnabled?: boolean;
|
|
8
15
|
searchURL?: string;
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
export const Search = ({
|
|
19
|
+
Button,
|
|
12
20
|
closeMenu,
|
|
13
21
|
searchEnabled,
|
|
14
22
|
searchURL,
|
|
15
|
-
}: SearchProps): JSX.Element => {
|
|
23
|
+
}: SearchProps): JSX.Element | null => {
|
|
16
24
|
const [searchOpen, setSearchOpen] = useState<boolean>(false);
|
|
25
|
+
|
|
26
|
+
if (!searchEnabled) return null;
|
|
27
|
+
|
|
17
28
|
return (
|
|
18
29
|
<>
|
|
19
|
-
{
|
|
20
|
-
<SearchButton openSearch={(): void => setSearchOpen(true)} />
|
|
21
|
-
)}
|
|
30
|
+
<Button onClick={(): void => setSearchOpen(true)} />
|
|
22
31
|
<SearchBar
|
|
23
32
|
closeMenu={closeMenu}
|
|
24
33
|
closeSearch={(): void => setSearchOpen(false)}
|
|
@@ -28,3 +37,29 @@ export const Search = ({
|
|
|
28
37
|
</>
|
|
29
38
|
);
|
|
30
39
|
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Renders search button.
|
|
43
|
+
* @param props - Button props.
|
|
44
|
+
* @returns button.
|
|
45
|
+
*/
|
|
46
|
+
export function renderButton(props: MButtonProps): JSX.Element {
|
|
47
|
+
return (
|
|
48
|
+
<StyledButton startIcon={<SearchIcon />} variant="nav" {...props}>
|
|
49
|
+
Search
|
|
50
|
+
</StyledButton>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Renders search icon button.
|
|
56
|
+
* @param props - Button props.
|
|
57
|
+
* @returns icon button.
|
|
58
|
+
*/
|
|
59
|
+
export function renderIconButton(props: MIconButtonProps): JSX.Element {
|
|
60
|
+
return (
|
|
61
|
+
<MIconButton color="ink" {...props}>
|
|
62
|
+
<SearchIcon fontSize="medium" />
|
|
63
|
+
</MIconButton>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -8,6 +8,7 @@ import { AppBar } from "../../../../../../header.styles";
|
|
|
8
8
|
import { DrawerNavigation as Navigation } from "../../../Actions/components/Menu/components/Content/components/Navigation/navigation.styles";
|
|
9
9
|
import { Toolbar } from "../../../Actions/components/Menu/components/Toolbar/toolbar";
|
|
10
10
|
import { MenuItem } from "../NavigationMenuItems/navigationMenuItems";
|
|
11
|
+
import { DIALOG_PROPS } from "./common/constants";
|
|
11
12
|
import { Slide } from "./components/Slide/slide";
|
|
12
13
|
import {
|
|
13
14
|
Button as BackButton,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
export interface NavigationDrawerProps {
|
|
19
20
|
closeAncestor?: () => void;
|
|
20
21
|
headerProps?: HeaderProps;
|
|
22
|
+
isMenuIn: boolean;
|
|
21
23
|
isSelected?: boolean;
|
|
22
24
|
menuItems: MenuItem[];
|
|
23
25
|
menuLabel: ReactNode;
|
|
@@ -27,6 +29,7 @@ export interface NavigationDrawerProps {
|
|
|
27
29
|
export const NavigationDrawer = ({
|
|
28
30
|
closeAncestor,
|
|
29
31
|
headerProps,
|
|
32
|
+
isMenuIn,
|
|
30
33
|
isSelected = false,
|
|
31
34
|
menuItems,
|
|
32
35
|
menuLabel,
|
|
@@ -47,15 +50,10 @@ export const NavigationDrawer = ({
|
|
|
47
50
|
{menuLabel}
|
|
48
51
|
</Button>
|
|
49
52
|
<Dialog
|
|
50
|
-
|
|
51
|
-
fullScreen
|
|
52
|
-
hideBackdrop
|
|
53
|
-
keepMounted={false}
|
|
53
|
+
{...DIALOG_PROPS}
|
|
54
54
|
onClose={closeDrawers}
|
|
55
55
|
open={open}
|
|
56
|
-
PaperProps={{ elevation: 0 }}
|
|
57
56
|
TransitionComponent={Slide}
|
|
58
|
-
transitionDuration={300}
|
|
59
57
|
>
|
|
60
58
|
<AppBar component="div" elevation={1}>
|
|
61
59
|
<Toolbar onClose={closeDrawers} {...headerProps} />
|
|
@@ -72,6 +70,7 @@ export const NavigationDrawer = ({
|
|
|
72
70
|
<Navigation
|
|
73
71
|
closeAncestor={closeDrawers}
|
|
74
72
|
headerProps={headerProps}
|
|
73
|
+
isMenuIn={isMenuIn}
|
|
75
74
|
links={menuItems}
|
|
76
75
|
pathname={pathname}
|
|
77
76
|
/>
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PopperProps as MPopperProps } from "@mui/material";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
vertical: "top",
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const MENU_PROPS: Partial<MMenuProps> = {
|
|
14
|
-
slotProps: {
|
|
15
|
-
paper: {
|
|
16
|
-
variant: "menu",
|
|
3
|
+
export const POPPER_PROPS: Partial<MPopperProps> = {
|
|
4
|
+
modifiers: [
|
|
5
|
+
{
|
|
6
|
+
name: "flip",
|
|
7
|
+
options: {
|
|
8
|
+
padding: 16,
|
|
9
|
+
},
|
|
17
10
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
11
|
+
],
|
|
12
|
+
placement: "bottom-start",
|
|
13
|
+
role: "presentation",
|
|
14
|
+
transition: true,
|
|
23
15
|
};
|