Skip to content

Commit 373f08f

Browse files
committed
chore: add breadcrumb routing in projects
1 parent 57b2bcb commit 373f08f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

examples/kendo-react-freemium/src/pages/Projects.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Avatar, Breadcrumb } from "@progress/kendo-react-layout";
1+
import { Avatar, Breadcrumb, BreadcrumbLinkMouseEvent } from "@progress/kendo-react-layout";
22
import { Button } from "@progress/kendo-react-buttons";
33
import { Grid, GridColumn, GridCustomCellProps, GridPageChangeEvent, GridToolbar } from "@progress/kendo-react-grid";
44
import { exportIcon, filterClearIcon, filterIcon, homeIcon, plusIcon, printIcon, searchIcon } from "@progress/kendo-svg-icons";
@@ -11,6 +11,7 @@ import { priorities, projectManagers, projectsData } from "./data";
1111
import { CSVLink } from 'react-csv';
1212
import { HeaderTdElement, PagerTargetEvent } from "@progress/kendo-react-data-tools";
1313
import { DropDownList } from "@progress/kendo-react-dropdowns";
14+
import { useNavigate } from "react-router-dom";
1415

1516
interface DataModel {
1617
id: string;
@@ -128,12 +129,18 @@ export const getItems = () => {
128129
};
129130

130131
export default function Projects() {
132+
const navigate = useNavigate();
131133
const [page, setPage] = React.useState<PageState>(initialDataState);
132134
const [pageSizeValue, setPageSizeValue] = React.useState<number | string | undefined>();
133135
const [data, setData] = React.useState<any>({ data: [], total: 0 });
134136
const [edit, setEdit] = React.useState({});
135137
const [filter, setFilter] = React.useState(initialFilter);
136138

139+
const handleItemSelect = (e: BreadcrumbLinkMouseEvent) => {
140+
if (e.id === 'home') {
141+
navigate('/');
142+
}
143+
}
137144

138145
React.useEffect(() => {
139146
let newItems = getItems();
@@ -182,7 +189,7 @@ export default function Projects() {
182189

183190
return (
184191
<div style={{minHeight: 'calc(100vh - 106px)'}} className="flex flex-col p-10 gap-6">
185-
<Breadcrumb data={breadcrumbItems} className="!bg-app-surface" />
192+
<Breadcrumb data={breadcrumbItems} onItemSelect={handleItemSelect} className="!bg-app-surface" />
186193

187194
<div className="flex flex-wrap items-center justify-between">
188195
<h1 className="text-4xl">Projects</h1>

0 commit comments

Comments
 (0)