Skip to content

Commit

Permalink
fix(hamburger & sub navigation): user experience enhancements (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
manojava-gk authored Feb 12, 2024
1 parent 9b59d44 commit 3ff54ce
Show file tree
Hide file tree
Showing 18 changed files with 718 additions and 229 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
- handle set read/unread correctly
- IDP Management
- Allow 6-36 alphanumeric characters for IDP extID
- Hamburger
- Slide effect on click of hamburger
- New UI navigation when menu has sub sections
- Subnavigation
- Show sub navigation button text in one line

## 1.8.0-RC4

Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/de/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
"dataspace": "Data Space",
"admin-credential": "Certification Mgmt",
"companyCertificate": "Company Certificates",
"companyWallet": "Company Wallet"
"companyWallet": "Company Wallet",
"mycompany": "My Company",
"mynotifications": "My Notifications"
},
"overlays": {
"invite": "Neuen Geschäftspartner einladen",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
"dataspace": "Data Space",
"admin-credential": "Certification Mgmt",
"companyCertificate": "Company Certificates",
"companyWallet": "Company Wallet"
"companyWallet": "Company Wallet",
"mycompany": "My Company",
"mynotifications": "My Notifications"
},
"overlays": {
"invite": "Invite new Business Partner",
Expand Down
60 changes: 37 additions & 23 deletions src/components/pages/Home/components/MenuInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import ClickAwayListener from '@mui/material/ClickAwayListener'
import type { MenuItem, Tree } from 'types/MainTypes'
import CloseIcon from '@mui/icons-material/Close'
import { MobileMenu } from 'components/shared/MobileMenu'
import { Drawer } from '@mui/material'

export const MenuInfo = ({ main }: { main: Tree[] }) => {
const { t } = useTranslation()
Expand All @@ -45,28 +46,41 @@ export const MenuInfo = ({ main }: { main: Tree[] }) => {
const menu = addTitle(main) ?? []

return (
<>
{visible && (
<ClickAwayListener
onClickAway={() => dispatch(setAppear({ MENU: !visible }))}
>
<div className="MenuInfo">
<CloseIcon
onClick={() => dispatch(setAppear({ MENU: !visible }))}
sx={{
color: '#B6B6B6',
}}
className="closeIcon"
/>
<MobileMenu
className="userMenuInfo"
component={Link}
divider
items={menu}
/>
</div>
</ClickAwayListener>
)}
</>
<Drawer
sx={{
width: '280px',
flexShrink: 0,
'& .MuiDrawer-paper': {
width: '280px',
background: 'transparent',
borderColor: 'transparent',
},
}}
variant="persistent"
anchor="right"
open={visible}
>
<ClickAwayListener
onClickAway={() => {
//do nothing
}}
>
<div className="MenuInfo">
<CloseIcon
onClick={() => dispatch(setAppear({ MENU: !visible }))}
sx={{
color: '#B6B6B6',
}}
className="closeIcon"
/>
<MobileMenu
className="userMenuInfo"
component={Link}
divider
items={menu}
/>
</div>
</ClickAwayListener>
</Drawer>
)
}
5 changes: 4 additions & 1 deletion src/components/pages/Home/components/MenuInfo/menu-info.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
top: 0px;
z-index: 999;
background: #fff;
box-shadow: 0px 10px 20px rgb(80 80 80 / 30%);
right: 0px;
width: 280px;
padding: 10px 0px;
Expand All @@ -37,3 +36,7 @@
.userMenuInfo {
margin-top: 20px;
}

.dep {
transition: all 3s ease-out;
}
96 changes: 96 additions & 0 deletions src/components/shared/MobileMenu/MenuChildren.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/********************************************************************************
* Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { Box, Link, useTheme } from '@mui/material'
import { Typography } from '@catena-x/portal-shared-components'
import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft'
import type { MenuItemProps } from './MenuItem'
import React from 'react'

type LinkItem = Partial<Record<'href' | 'to', string>>

export interface MenuSubItemsProps extends LinkItem {
onClick: () => void
onHide: () => void
children: MenuItemProps[]
component: React.ElementType
}

export const MenuSubItems = ({
onClick,
onHide,
children,
component = Link,
}: MenuSubItemsProps): JSX.Element => {
const { spacing } = useTheme()
return (
<Box>
<Box
sx={{
display: 'flex',
justifyContent: 'flex-start',
marginLeft: '20px',
cursor: 'pointer',
marginBottom: '20px',
}}
onClick={onHide}
>
<KeyboardArrowLeftIcon sx={{ color: 'icon.icon02' }} />
<Typography
sx={{
paddingLeft: '10px',
}}
variant="body2"
>
back
</Typography>
</Box>
{children?.map((item) => (
<Link
component={component}
key={item.title}
sx={{
color: 'text.primary',
pointerEvents: 'auto',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: spacing(1.5, 2),
borderRadius: 3,
typography: 'label3',
textDecoration: 'none',
whiteSpace: 'nowrap',
marginLeft: '10px',
':hover': {
backgroundColor: 'selected.hover',
color: 'primary.dark',
'.MuiSvgIcon-root': {
color: 'primary.dark',
},
},
}}
onClick={onClick}
{...item}
>
{item.title}
</Link>
))}
</Box>
)
}
85 changes: 85 additions & 0 deletions src/components/shared/MobileMenu/MenuFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/********************************************************************************
* Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { Box } from '@mui/material'
import { Typography, LanguageSwitch } from '@catena-x/portal-shared-components'
import { useDispatch } from 'react-redux'
import i18next, { changeLanguage, t } from 'i18next'
import I18nService from 'services/I18nService'
import { setLanguage } from 'features/language/actions'
import UserService from 'services/UserService'

export const MenuFooter = (): JSX.Element => {
const dispatch = useDispatch()
return (
<Box
sx={{
display: 'flex',
justifyContent: 'space-between',
alignContent: 'center',
alignItems: 'center',
cursor: 'pointer',
}}
>
<LanguageSwitch
current={i18next.language}
languages={I18nService.supportedLanguages.map((key) => ({ key }))}
onChange={(key: string) => {
dispatch(setLanguage({ language: key }))
changeLanguage(key)
}}
/>
<Box
onClick={() => {
window.open(
`${document.location.origin}/documentation/`,
'documentation',
'noreferrer'
)
}}
>
<Typography
sx={{
paddingLeft: '10px',
}}
variant="body2"
>
{t('pages.help')}
</Typography>
</Box>
<Box
sx={{
marginRight: '20px',
}}
onClick={() => {
UserService.doLogout()
}}
>
<Typography
sx={{
paddingLeft: '10px',
}}
variant="body2"
>
{t('pages.logout')}
</Typography>
</Box>
</Box>
)
}
Loading

0 comments on commit 3ff54ce

Please sign in to comment.