generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(heureka): switches to TopNavigationItem (#344)
* chore(heureka): fix linting issues * feat(heureka): uses TopNavigationItem instead of TabNavigationItem * Create hot-dolphins-know.md * Revert "chore(heureka): fix linting issues" This reverts commit b4ecc09. * feat(heureka): renames all tab names into navEntry * Create little-onions-obey.md * Delete .changeset/hot-dolphins-know.md
- Loading branch information
Showing
12 changed files
with
106 additions
and
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fake-scope/fake-pkg": minor | ||
--- | ||
|
||
feat(heureka): switches to TopNavigationItem |
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
File renamed without changes.
File renamed without changes.
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
73 changes: 73 additions & 0 deletions
73
apps/heureka/src/components/navEntries/NavEntryContext.jsx
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,73 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useMemo } from "react" | ||
import { Container, TopNavigation, TopNavigationItem } from "@cloudoperators/juno-ui-components" | ||
import NavEntry from "./NavEntry" | ||
import { useGlobalsActions, useGlobalsActiveNavEntry } from "../../hooks/useAppStore" | ||
|
||
import ServicesNav from "../services/ServicesTopNavItem" | ||
import IssueMatchesNav from "../issueMatches/IssueMatchesTopNavItem" | ||
import ComponentsNav from "../components/ComponentsTopNavItem" | ||
|
||
const NAV_CONFIG = [ | ||
{ | ||
label: "Services", | ||
value: "Services", | ||
icon: "dns", | ||
component: ServicesNav, | ||
}, | ||
{ | ||
label: "IssueMatches", | ||
value: "IssueMatches", | ||
icon: "autoAwesomeMotion", | ||
component: IssueMatchesNav, | ||
}, | ||
{ | ||
label: "Components", | ||
value: "Components", | ||
icon: "autoAwesomeMotion", | ||
component: ComponentsNav, | ||
}, | ||
] | ||
|
||
const NavEntryContext = () => { | ||
const { setActiveNavEntry } = useGlobalsActions() | ||
const activeNavEntry = useGlobalsActiveNavEntry() | ||
|
||
// Memorized top navigation items | ||
const memorizedNavItems = useMemo( | ||
() => | ||
NAV_CONFIG.map((nav) => ( | ||
<TopNavigationItem | ||
key={nav.value} | ||
label={nav.label} | ||
active={activeNavEntry === nav.value} // Set the active item | ||
onClick={() => setActiveNavEntry(nav.value)} // Trigger tab change | ||
/> | ||
)), | ||
[activeNavEntry, setActiveNavEntry] | ||
) | ||
|
||
// Memorized tab panels | ||
const memorizedNavItemContents = useMemo( | ||
() => | ||
NAV_CONFIG.map((nav) => ( | ||
<NavEntry key={nav.value} value={nav.value}> | ||
<nav.component /> | ||
</NavEntry> | ||
)), | ||
[] | ||
) | ||
|
||
return ( | ||
<> | ||
<TopNavigation onActiveItemChange={() => {}}>{memorizedNavItems}</TopNavigation> | ||
<Container py>{memorizedNavItemContents}</Container> | ||
</> | ||
) | ||
} | ||
|
||
export default NavEntryContext |
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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