-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4404] Make navigation bar home button fully customizable
* Add 'navigationBarHomeExtensionPoint' which relies on 'navigationBarIconExtensionPoint'. This extension point allows contributing an arbitrary React component for the top left part of the navigation bar. It defaults to the same behavior a previously: the Sirius logo is used as a round button that links to the homepage of the application. * Fix corresponding shape and ADR to remove the notion that 'navigationBarIconExtensionPoint' would get deleted. * Document the new extension point in the changelog. Also add reference to the shape and ADR that were made for this change. * Add a few missing type annotations. Bug: #4404 Signed-off-by: Florent Latombe <[email protected]>
- Loading branch information
Showing
9 changed files
with
85 additions
and
27 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
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
36 changes: 36 additions & 0 deletions
36
packages/sirius-web/frontend/sirius-web-application/src/navigationBar/NavigationBarHome.tsx
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,36 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
import { useComponent } from '@eclipse-sirius/sirius-components-core'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Link from '@mui/material/Link'; | ||
import Tooltip from '@mui/material/Tooltip'; | ||
import { Link as RouterLink } from 'react-router-dom'; | ||
import { useNavigationBarStyles } from './NavigationBar'; | ||
import { NavigationBarHomeProps } from './NavigationBar.types'; | ||
import { navigationBarIconExtensionPoint } from './NavigationBarExtensionPoints'; | ||
|
||
export const SiriusWebNavigationBarHome: React.ComponentType<NavigationBarHomeProps> = ({}: NavigationBarHomeProps) => { | ||
const { classes } = useNavigationBarStyles(); | ||
const { Component: Icon } = useComponent(navigationBarIconExtensionPoint); | ||
|
||
return ( | ||
<Tooltip title="Back to the homepage"> | ||
<Link component={RouterLink} to="/" className={classes.link} color="inherit"> | ||
<IconButton className={classes.onDarkBackground} color="inherit"> | ||
<Icon /> | ||
</IconButton> | ||
</Link> | ||
</Tooltip> | ||
); | ||
}; |
19 changes: 19 additions & 0 deletions
19
packages/sirius-web/frontend/sirius-web-application/src/navigationBar/NavigationBarIcon.tsx
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,19 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
import { SiriusIcon } from '../core/SiriusIcon'; | ||
import { NavigationBarIconProps } from './NavigationBar.types'; | ||
|
||
export const SiriusWebNavigationBarIcon = ({}: NavigationBarIconProps) => { | ||
return <SiriusIcon fontSize="large" />; | ||
}; |