Skip to content

Commit

Permalink
πŸ’„ feat(layout-page): render breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
ythecombinator committed Dec 3, 2023
1 parent 8c1c8ae commit 6decc5e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/layouts/layout-page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { FunctionComponent, PropsWithChildren } from 'react';

import PageTitle, { PageTitleProps } from 'components/shared/page-title';
import { usePathname } from 'next/navigation';
import { toBreadcrumbs } from 'utils/string';
import Breadcrumbs from 'components/shared/breadcrumbs';

/*~
* TYPES
Expand All @@ -22,8 +25,12 @@ const PageLayout: FunctionComponent<PropsWithChildren<PageLayoutProps>> = ({
headingGradient,
children,
}) => {
const pathname = usePathname();
const breadcrumbs = toBreadcrumbs(pathname);

return (
<div className="mt-6 px-2 sm:px-0">
{breadcrumbs.length > 1 && <Breadcrumbs items={breadcrumbs} />}
<div className="space-y-2 pt-6 pb-8 md:space-y-5">
<PageTitle gradient={headingGradient}>{heading}</PageTitle>
{subHeading}
Expand Down

0 comments on commit 6decc5e

Please sign in to comment.