Skip to content

Commit

Permalink
feat: add breadcrumbs to Project page
Browse files Browse the repository at this point in the history
  • Loading branch information
asabotovich committed Apr 11, 2024
1 parent 5c03739 commit 8b91b5f
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 0 deletions.
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/components/ProjectPage/ProjectPage.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Breadcrumbs {
padding-bottom: var(--gap-s);
}
17 changes: 17 additions & 0 deletions src/components/ProjectPage/ProjectPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { useCallback, useEffect } from 'react';
import NextLink from 'next/link';
import { ListView, nullable } from '@taskany/bricks';
import { Breadcrumb, Breadcrumbs, Link } from '@taskany/bricks/harmony';

import { Page } from '../Page/Page';
import { GoalByIdReturnType } from '../../../trpc/inferredTypes';
import { refreshInterval } from '../../utils/config';
import { routes } from '../../hooks/router';
import { ExternalPageProps } from '../../utils/declareSsrProps';
import { useUrlFilterParams } from '../../hooks/useUrlFilterParams';
import { useLocalStorage } from '../../hooks/useLocalStorage';
Expand All @@ -18,6 +21,7 @@ import { PresetModals } from '../PresetModals';
import { FiltersPanel } from '../FiltersPanel/FiltersPanel';

import { tr } from './ProjectPage.i18n';
import s from './ProjectPage.module.css';

export const projectsSize = 20;

Expand Down Expand Up @@ -115,6 +119,18 @@ export const ProjectPage = ({ user, ssrTime, params: { id }, defaultPresetFallba
</FiltersPanel>
}
>
{nullable(project?.parent, (p) => (
<Breadcrumbs className={s.Breadcrumbs}>
{p.map((item) => (
<Breadcrumb key={item.id}>
<NextLink href={routes.project(item.id)} passHref legacyBehavior>
<Link>{item.title}</Link>
</NextLink>
</Breadcrumb>
))}
</Breadcrumbs>
))}

<ListView onKeyboardClick={handleItemEnter}>
{nullable(project, (p) => (
<ProjectListItemConnected
Expand All @@ -127,6 +143,7 @@ export const ProjectPage = ({ user, ssrTime, params: { id }, defaultPresetFallba
/>
))}
</ListView>

<PresetModals preset={preset} />
</Page>
);
Expand Down

0 comments on commit 8b91b5f

Please sign in to comment.