-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hamburger & sub navigation): user experience enhancements (#479)
- Loading branch information
1 parent
9b59d44
commit 3ff54ce
Showing
18 changed files
with
718 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
Oops, something went wrong.