-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
23 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,41 @@ | ||
import {useSelector} from "react-redux" | ||
import {Breadcrumbs, Skeleton, Anchor} from "@mantine/core" | ||
|
||
import {selectPanelBreadcrumbs} from "@/slices/dualPanel" | ||
import type {PanelMode, NType} from "@/types" | ||
import type {RootState} from "@/app/types" | ||
|
||
type Args = { | ||
mode: PanelMode | ||
onClick: (node: NType) => void | ||
} | ||
|
||
export default function BreadcrumbsComponent({mode, onClick}: Args) { | ||
const items = useSelector<RootState>(state => | ||
selectPanelBreadcrumbs(state, mode) | ||
) as Array<[string, string]> | null | undefined | ||
|
||
if (!items) { | ||
return ( | ||
<Skeleton width={"25%"} my="md"> | ||
<Breadcrumbs>{["one", "two"]}</Breadcrumbs> | ||
</Skeleton> | ||
) | ||
} | ||
console.log(items) | ||
const links = items.slice(0, -1).map(i => ( | ||
<Anchor key={i[0]} onClick={() => onClick({id: i[0], ctype: "folder"})}> | ||
{i[1]} | ||
</Anchor> | ||
)) | ||
const lastOne = items[items.length - 1][1] | ||
|
||
return ( | ||
<> | ||
<Breadcrumbs> | ||
{links} | ||
{lastOne} | ||
</Breadcrumbs> | ||
</> | ||
) | ||
} |
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,3 @@ | ||
import Breadcrumbs from "./Breadcrumbs" | ||
|
||
export default Breadcrumbs |
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
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
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