-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: definition and search updates (#1298)
#1267 - Refactors the table header into a separate component - Adds new table definition header component for increasing visibility of the dataset / deposition description ## Demos ### Browse Datasets https://dev-table-def.cryoet.dev.si.czi.technology/browse-data/datasets <img width="1728" alt="image" src="https://github.com/user-attachments/assets/51702ce4-6577-4183-aa8f-3e89e788f13a"> ### Browse Depositions https://dev-table-def.cryoet.dev.si.czi.technology/browse-data/depositions <img width="1728" alt="image" src="https://github.com/user-attachments/assets/50f702bc-ac3d-4387-975e-4386f66e7aa1">
- Loading branch information
1 parent
c31b63b
commit 58e36ea
Showing
13 changed files
with
217 additions
and
142 deletions.
There are no files selected for viewing
8 changes: 2 additions & 6 deletions
8
frontend/packages/data-portal/app/components/BrowseData/BrowseDataHeader.tsx
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,13 +1,9 @@ | ||
import { BrowseDataSearch } from './BrowseDataSearch' | ||
import { BrowseDataTabs } from './BrowseDataTabs' | ||
|
||
export function BrowseDataHeader() { | ||
return ( | ||
<div className="px-sds-xl py-sds-l flex justify-center"> | ||
<div className="flex gap-sds-xl w-full max-w-content"> | ||
<BrowseDataSearch /> | ||
<BrowseDataTabs /> | ||
</div> | ||
<div className="px-sds-xl py-[18px] flex w-full max-w-content"> | ||
<BrowseDataTabs /> | ||
</div> | ||
) | ||
} |
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
57 changes: 57 additions & 0 deletions
57
frontend/packages/data-portal/app/components/TablePageLayout/TableHeader.tsx
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,57 @@ | ||
import { Link } from 'app/components/Link' | ||
import { TableCount } from 'app/components/TablePageLayout/TableCount' | ||
import { useI18n } from 'app/hooks/useI18n' | ||
import { cns } from 'app/utils/cns' | ||
|
||
export interface TableHeaderProps { | ||
countLabel: string | ||
description?: string | ||
filteredCount: number | ||
title: string | ||
totalCount: number | ||
learnMoreLink?: string | ||
} | ||
|
||
export function TableHeader({ | ||
countLabel, | ||
description, | ||
filteredCount, | ||
title, | ||
totalCount, | ||
learnMoreLink, | ||
}: TableHeaderProps) { | ||
const { t } = useI18n() | ||
|
||
return ( | ||
<div | ||
className={cns( | ||
'ml-sds-xl p-sds-m flex items-center gap-x-sds-xl screen-1024:mr-sds-xl', | ||
// NOTE: The title background color is gray on the browse datasets and browse depositions pages | ||
// If we want to add a description to the single deposition or single run pages, we may need to update this | ||
!!description && 'bg-sds-color-primitive-gray-100', | ||
)} | ||
> | ||
<p className="text-sds-header-l leading-sds-header-l font-semibold"> | ||
{title} | ||
</p> | ||
|
||
<TableCount | ||
filteredCount={filteredCount} | ||
totalCount={totalCount} | ||
type={countLabel} | ||
/> | ||
|
||
<p className="inline"> | ||
{description} | ||
{learnMoreLink && ( | ||
<Link | ||
to={learnMoreLink} | ||
className="text-sds-color-primitive-blue-400 ml-sds-xxs" | ||
> | ||
{t('learnMore')} | ||
</Link> | ||
)} | ||
</p> | ||
</div> | ||
) | ||
} |
55 changes: 55 additions & 0 deletions
55
frontend/packages/data-portal/app/components/TablePageLayout/TableHeaderDefinition.tsx
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,55 @@ | ||
import { ReactNode } from 'react' | ||
|
||
import { Link } from 'app/components/Link' | ||
import { useI18n } from 'app/hooks/useI18n' | ||
|
||
import { TableCount } from './TableCount' | ||
import { TableHeaderProps } from './TableHeader' | ||
|
||
export function TableHeaderDefinition({ | ||
countLabel, | ||
filteredCount, | ||
totalCount, | ||
title, | ||
description, | ||
learnMoreLink, | ||
search, | ||
}: TableHeaderProps & { | ||
search?: ReactNode | ||
}) { | ||
const { t } = useI18n() | ||
|
||
return ( | ||
<div className="pt-sds-s px-sds-xl max-w-content"> | ||
<h1 className="text-sds-header-xxl leading-sds-header-xxl tracking-sds-header-xxl font-semibold"> | ||
{title} | ||
</h1> | ||
|
||
<p className="text-sds-body-s leading-sds-body-s tracking-sds-body-s max-w-[600px] mt-sds-s"> | ||
<span className="text-sds-color-semantic-text-base-secondary"> | ||
{description} | ||
</span> | ||
|
||
{learnMoreLink && ( | ||
<Link | ||
className="text-sds-color-semantic-text-action-default hover:text-sds-color-semantic-text-action-hover" | ||
to={learnMoreLink} | ||
> | ||
{' '} | ||
{t('learnMore')} | ||
</Link> | ||
)} | ||
</p> | ||
|
||
<div className="flex justify-between items-center mt-sds-xl"> | ||
<TableCount | ||
filteredCount={filteredCount} | ||
totalCount={totalCount} | ||
type={countLabel} | ||
/> | ||
|
||
{search} | ||
</div> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.