-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FOROME-353): add modals for table samples
* feat(FOROME-353): add modals for table samples
- Loading branch information
Showing
5 changed files
with
94 additions
and
20 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 |
---|---|---|
|
@@ -9,7 +9,7 @@ on: | |
- '*FOROME-*' | ||
- '!main' | ||
- '!develop' | ||
tags: [ stage ] | ||
tags: [ dev ] | ||
|
||
jobs: | ||
build: | ||
|
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,62 @@ | ||
import { ReactElement } from 'react' | ||
import cn from 'classnames' | ||
|
||
import { useToggle } from '@core/hooks/use-toggle' | ||
import filterZone from '@store/filterZone' | ||
import { IQualities } from './cell-samples' | ||
import { ModalTooltip } from './modal-tooltip' | ||
|
||
interface ICellSamplesProps { | ||
qualities: IQualities | ||
sample: string | ||
samplesAmount: number | ||
index: number | ||
} | ||
|
||
export const CellSample = ({ | ||
qualities, | ||
sample, | ||
samplesAmount, | ||
index, | ||
}: ICellSamplesProps): ReactElement => { | ||
const genotype: string = qualities[sample].genotype | ||
const quality: number = qualities[sample].g_quality | ||
|
||
const [isTooltipVisible, showTooltip, hideTooltip] = useToggle() | ||
|
||
const isTruncated = qualities[sample].genotype.length > 10 | ||
|
||
const shouldTooltipBeVisible = | ||
isTooltipVisible && isTruncated && samplesAmount < 4 | ||
|
||
return ( | ||
<div | ||
onMouseEnter={showTooltip} | ||
onMouseLeave={hideTooltip} | ||
key={sample} | ||
className={cn('relative w-1/3 px-4 py-4', { | ||
'bg-orange-light': filterZone.isFather && index === 2, | ||
'bg-yellow-light': filterZone.isMother && index === 1, | ||
'bg-purple-light': filterZone.isProband && index === 0, | ||
})} | ||
> | ||
<div>{sample}</div> | ||
|
||
<div className="truncate">{genotype}</div> | ||
|
||
<div>{quality}</div> | ||
|
||
{shouldTooltipBeVisible && ( | ||
<ModalTooltip> | ||
<div className="flex flex-wrap justify-start"> | ||
<div>{sample}</div> | ||
|
||
<div className="w-full">{genotype}</div> | ||
|
||
<div>{quality}</div> | ||
</div> | ||
</ModalTooltip> | ||
)} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { PropsWithChildren, ReactElement, ReactNode } from 'react' | ||
|
||
export const ModalTooltip = ({ | ||
children, | ||
}: PropsWithChildren<unknown>): ReactElement => ( | ||
<div className="absolute flex flex-wrap items-center h-full px-2 top-0 z-50 shadow-dark rounded-md bg-white"> | ||
{children} | ||
</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