2022-11-19 14:21:26 +00:00
|
|
|
import { ArrowLeftIcon, HomeIcon } from "@heroicons/react/24/outline";
|
|
|
|
import Link from "next/link";
|
|
|
|
import { useRouter } from "next/router";
|
|
|
|
|
|
|
|
type BreadcrumbsProps = {
|
|
|
|
children: any;
|
|
|
|
};
|
|
|
|
|
2022-11-24 13:48:18 +00:00
|
|
|
const Breadcrumbs: React.FC<BreadcrumbsProps> = ({ children }: BreadcrumbsProps) => {
|
2022-11-19 14:21:26 +00:00
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2022-12-13 15:52:44 +00:00
|
|
|
<div className="flex items-center">
|
2022-11-19 14:21:26 +00:00
|
|
|
<div
|
2022-12-13 15:52:44 +00:00
|
|
|
className="border hover:bg-gray-100 rounded h-8 w-8 text-sm grid place-items-center text-center cursor-pointer"
|
2022-11-19 14:21:26 +00:00
|
|
|
onClick={() => router.back()}
|
|
|
|
>
|
2022-12-13 15:52:44 +00:00
|
|
|
<ArrowLeftIcon className="h-3 w-3" />
|
2022-11-19 14:21:26 +00:00
|
|
|
</div>
|
2022-11-24 13:48:18 +00:00
|
|
|
{children}
|
2022-11-19 14:21:26 +00:00
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
type BreadcrumbItemProps = {
|
|
|
|
title: string;
|
|
|
|
link?: string;
|
|
|
|
icon?: any;
|
|
|
|
};
|
|
|
|
|
2022-11-24 13:48:18 +00:00
|
|
|
const BreadcrumbItem: React.FC<BreadcrumbItemProps> = ({ title, link, icon }) => {
|
2022-11-19 14:21:26 +00:00
|
|
|
return (
|
|
|
|
<>
|
2022-11-24 13:48:18 +00:00
|
|
|
{link ? (
|
|
|
|
<Link href={link}>
|
2022-12-13 15:52:44 +00:00
|
|
|
<a className="text-sm border-r-2 border-gray-300 px-3">
|
|
|
|
<p className={`${icon ? "flex items-center gap-2" : ""}`}>
|
2022-11-24 13:48:18 +00:00
|
|
|
{icon ?? null}
|
|
|
|
{title}
|
2022-11-19 14:21:26 +00:00
|
|
|
</p>
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
) : (
|
2022-12-13 15:52:44 +00:00
|
|
|
<div className="text-sm px-3">
|
|
|
|
<p className={`${icon ? "flex items-center gap-2" : ""}`}>
|
2022-11-24 13:48:18 +00:00
|
|
|
{icon}
|
|
|
|
{title}
|
2022-11-19 14:21:26 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export { Breadcrumbs, BreadcrumbItem };
|