Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(user menu): full height user menu #558

Merged
merged 4 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
- Business Partner Details
- Show certificate information which are associated with the bpn number.
- Activate on hover and click action to download the corresponding certificate
- Hamburger
- Full height user menu
- Click outside to close menu

## 1.8.0-RC6

Expand Down
11 changes: 8 additions & 3 deletions src/components/pages/Home/components/MenuInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,22 @@ export const MenuInfo = ({ main }: { main: Tree[] }) => {
flexShrink: 0,
'& .MuiDrawer-paper': {
width: '280px',
background: 'transparent',
borderColor: 'transparent',
boxShadow: '0px 0px 30px 1px rgb(0 0 0 / 40%)',
},
'& .MuiBackdrop-root': {
backgroundColor: 'transparent',
},
}}
variant="persistent"
anchor="right"
open={visible}
onClose={() => {
dispatch(setAppear({ MENU: !visible }))
}}
>
<ClickAwayListener
onClickAway={() => {
// visible && dispatch(setAppear({ MENU: !visible }))
// do nothing
}}
>
<div className="MenuInfo">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
right: 0px;
width: 280px;
padding: 10px 0px;
box-shadow: 0px 0px 30px 1px rgb(0 0 0 / 40%);
height: 99%;
}

.closeIcon {
Expand Down
91 changes: 52 additions & 39 deletions src/components/shared/MobileMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { type CompanyMenuTypes, MyCompanyLink } from './MyCompanyLink'
import { MenuSubItems } from './MenuChildren'
import { MenuFooter } from './MenuFooter'
import { t } from 'i18next'
import { PAGES } from 'types/Constants'

export interface MenuProps extends BoxProps {
items: MenuItemProps[]
Expand Down Expand Up @@ -89,45 +90,57 @@ export const MobileMenu = ({
}, [companyData])

return (
<Box {...props}>
{children.length === 0 && (
<>
<List sx={{ padding: 0 }}>
{items?.map((item) => (
<MenuItem
{...item}
component={component}
menuProps={props}
Menu={MobileMenu}
onSelect={onSelectItem}
onClick={onClick}
key={uniqueId('Menu')}
/>
))}
</List>
{divider && <Divider sx={{ margin: spacing(0, 1) }} />}
<ProfileLink to={'/account'} />
<NotificationLink to={'/notifications'} />
<MyCompanyLink companyMenu={companyMenu} onSelect={onSelectItem} />
{divider && <Divider sx={{ margin: spacing(0, 1) }} />}
</>
)}
{children?.length > 0 && (
<MenuSubItems
title={selectedSection}
onClick={() => {
dispatch(setAppear({ MENU: !visible }))
}}
onHide={() => {
setSelectedChildren([])
}}
component={component}
>
{children}
</MenuSubItems>
)}
{divider && <Divider sx={{ margin: spacing(0, 1) }} />}
<MenuFooter />
<Box
sx={{
display: 'flex',
flexDirection: 'column',
height: '100%',
justifyContent: 'space-between',
}}
{...props}
>
<Box>
{children.length === 0 && (
<>
<List sx={{ padding: 0 }}>
{items?.map((item) => (
<MenuItem
{...item}
component={component}
menuProps={props}
Menu={MobileMenu}
onSelect={onSelectItem}
onClick={onClick}
key={uniqueId('Menu')}
/>
))}
</List>
{divider && <Divider sx={{ margin: spacing(0, 1) }} />}
<ProfileLink to={PAGES.ACCOUNT} />
<NotificationLink to={PAGES.NOTIFICATIONS} />
<MyCompanyLink companyMenu={companyMenu} onSelect={onSelectItem} />
{divider && <Divider sx={{ margin: spacing(0, 1) }} />}
</>
)}
{children?.length > 0 && (
<MenuSubItems
title={selectedSection}
onClick={() => {
dispatch(setAppear({ MENU: !visible }))
}}
onHide={() => {
setSelectedChildren([])
}}
component={component}
>
{children}
</MenuSubItems>
)}
</Box>
<Box>
{divider && <Divider sx={{ margin: spacing(0, 1) }} />}
<MenuFooter />
</Box>
</Box>
)
}
Expand Down
1 change: 0 additions & 1 deletion src/components/shared/templates/Templates.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

h4 {
font-size: 16px;
text-transform: uppercase;
}
}

Expand Down
Loading