Skip to content

Commit

Permalink
[Tech] add NavBar Props
Browse files Browse the repository at this point in the history
  • Loading branch information
claire2212 committed Sep 19, 2024
1 parent 0297de2 commit eb7d429
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions frontend/src/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ import { Accent, Icon, IconButton } from '@mtes-mct/monitor-ui'
import ResponsiveNav from '@rsuite/responsive-nav'
import styled from 'styled-components'

export function NavBar({ children, onClose, onSelect }) {
type NavBarProps = {
children: React.ReactNode[]
name: string
onClose: (eventKey: string | number | undefined) => void
onSelect: (eventKey: string | number | undefined) => void
}
export function NavBar({ children, name, onClose, onSelect }: NavBarProps) {
const currentPath = useAppSelector(state => state.sideWindow.currentPath)

return (
<StyledResponsiveNav
activeKey={currentPath}
appearance="tabs"
data-cy="dashboards-nav"
data-cy={`${name}-nav`}
moreProps={{ placement: 'bottomEnd' }}
moreText={<IconButton accent={Accent.TERTIARY} Icon={Icon.More} />}
onItemRemove={onClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function DashboardsNavBar() {
const closeDashboard = () => {}

return (
<NavBar onClose={closeDashboard} onSelect={selectDashboard}>
<NavBar name="dashboards" onClose={closeDashboard} onSelect={selectDashboard}>
{tabs.map((item, index) => (
<ResponsiveNav.Item
key={item.nextPath}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/missions/MissionsNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function MissionsNavBar() {
}

return (
<NavBar onClose={removeTab} onSelect={selectTab}>
<NavBar name="missions" onClose={removeTab} onSelect={selectTab}>
{tabs.map((item, index) => (
<ResponsiveNav.Item key={item.nextPath} data-cy={`mission-${index}`} eventKey={item.nextPath} icon={item.icon}>
{item.label}
Expand Down

0 comments on commit eb7d429

Please sign in to comment.