Skip to content

Commit afafda1

Browse files
committed
Address PR feedback: improve navigation components
Signed-off-by: Andrew Sawers <ajmsawers@gmail.com>
1 parent 874a139 commit afafda1

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/components/Navigation/ActivityNav.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Copyright © 2022 Kaleido, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
117
import { InsertChartOutlined } from '@mui/icons-material';
218
import React, { useContext } from 'react';
319
import { useTranslation } from 'react-i18next';

src/components/Navigation/NavItem.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ interface Props {
2929
icon?: JSX.Element;
3030
rightIcon?: JSX.Element;
3131
isRoot?: boolean;
32-
33-
// NEW:
3432
to?: string; // internal route (React Router)
3533
href?: string; // external link
3634
action?: () => void; // fallback click handler (legacy)

src/components/Navigation/Navigation.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import MenuBookIcon from '@mui/icons-material/MenuBook';
44
import { Drawer, List } from '@mui/material';
55
import { default as React, useContext } from 'react';
66
import { useTranslation } from 'react-i18next';
7-
import { useLocation, useNavigate } from 'react-router-dom';
7+
import { useLocation } from 'react-router-dom';
88
import { ApplicationContext } from '../../contexts/ApplicationContext';
99
import { FF_NAV_PATHS } from '../../interfaces';
1010
import { MenuLogo } from '../MenuLogo';
@@ -23,7 +23,6 @@ export const Navigation: React.FC = () => {
2323
const { selectedNamespace } = useContext(ApplicationContext);
2424
const { t } = useTranslation();
2525
const { pathname } = useLocation();
26-
const navigate = useNavigate();
2726

2827
const makeDrawerContents = (
2928
<>

src/interfaces/navigation.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ export interface INavItem {
2121
itemIsActive: boolean;
2222
icon?: JSX.Element;
2323

24-
// NEW optional props for link-style behavior
24+
// Preferred props for link/navigation behavior
2525
to?: string; // internal React Router path
2626
href?: string; // external URL
2727

28-
// fallback for legacy click handlers
28+
// DEPRECATED: legacy click handler (prefer `to` or `href`)
29+
/** @deprecated use `to` or `href` instead */
2930
action?: () => void;
3031
}
3132

0 commit comments

Comments
 (0)