-
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.
Search bar for ontologies in OntologyCheckboxes
- Loading branch information
Showing
5 changed files
with
104 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
import { Breadcrumb } from "antd" | ||
import { Breadcrumb } from 'antd'; | ||
import { useLocation, Link } from 'react-router-dom'; | ||
// import { Link } from 'react-router'; | ||
export const Breadcrumbs = () => { | ||
const location = useLocation(); | ||
const pathParts = location.pathname.split('/').filter(Boolean); | ||
const pathArr = [] | ||
pathParts.forEach(path => { | ||
pathArr.push({ title: path, path: path }); | ||
}); | ||
|
||
console.log(location,'location'); | ||
|
||
const location = useLocation(); | ||
const pathParts = location.pathname.split('/').filter(Boolean); | ||
const pathArr = []; | ||
pathParts.forEach(path => { | ||
pathArr.push({ title: path, path: path }); | ||
}); | ||
|
||
return <span className="breadcrumbs"> | ||
<li><Link to={'/'}>Home</Link> {location.pathname != '/' && <span> / </span>}</li> | ||
return ( | ||
<span className="breadcrumbs"> | ||
<li> | ||
<Link to={'/'}>Home</Link>{' '} | ||
{location.pathname != '/' && <span> / </span>} | ||
</li> | ||
<Breadcrumb itemRender={itemRender} items={pathArr} /> | ||
</span> | ||
} | ||
</span> | ||
); | ||
}; | ||
function itemRender(currentRoute, params, items, pathArr) { | ||
const isLast = currentRoute?.path === items[items.length - 1]?.path; | ||
const isLast = currentRoute?.path === items[items.length - 1]?.path; | ||
|
||
return <> | ||
{isLast ? ( | ||
<span>{currentRoute.title}</span> | ||
) : ( | ||
<Link to={`/${pathArr.join("/")}`}>{currentRoute.title}</Link> | ||
)} | ||
</> | ||
} | ||
return ( | ||
<> | ||
{isLast ? ( | ||
<span>{currentRoute.title}</span> | ||
) : ( | ||
<Link to={`/${pathArr.join('/')}`}>{currentRoute.title}</Link> | ||
)} | ||
</> | ||
); | ||
} |
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