-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer): tip positioning modal and assets (#16612)
closes AUTH-928
- Loading branch information
Showing
22 changed files
with
1,305 additions
and
20 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
protocol-designer/src/assets/images/tip_side_bottom_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions
45
protocol-designer/src/assets/images/tip_side_mid_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions
49
protocol-designer/src/assets/images/tip_side_top_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
protocol-designer/src/assets/images/tip_top_bottom_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
77 changes: 77 additions & 0 deletions
77
protocol-designer/src/organisms/TipPositionModal/TipPositionSideView.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,77 @@ | ||
import round from 'lodash/round' | ||
import { useTranslation } from 'react-i18next' | ||
import { | ||
Box, | ||
COLORS, | ||
OVERFLOW_HIDDEN, | ||
POSITION_ABSOLUTE, | ||
POSITION_RELATIVE, | ||
StyledText, | ||
} from '@opentrons/components' | ||
import BOTTOM_LAYER from '../../assets/images/tip_side_bottom_layer.svg' | ||
import MID_LAYER from '../../assets/images/tip_side_mid_layer.svg' | ||
import TOP_LAYER from '../../assets/images/tip_side_top_layer.svg' | ||
|
||
const WELL_HEIGHT_PIXELS = 71 | ||
const WELL_WIDTH_PIXELS = 70 | ||
const PIXEL_DECIMALS = 2 | ||
|
||
interface TipPositionAllVizProps { | ||
mmFromBottom: number | ||
xPosition: number | ||
wellDepthMm: number | ||
xWidthMm: number | ||
} | ||
|
||
export function TipPositionSideView( | ||
props: TipPositionAllVizProps | ||
): JSX.Element { | ||
const { mmFromBottom, xPosition, wellDepthMm, xWidthMm } = props | ||
const { t } = useTranslation('application') | ||
const fractionOfWellHeight = mmFromBottom / wellDepthMm | ||
const pixelsFromBottom = | ||
fractionOfWellHeight * WELL_HEIGHT_PIXELS - WELL_HEIGHT_PIXELS | ||
const roundedPixelsFromBottom = round(pixelsFromBottom, PIXEL_DECIMALS) | ||
const bottomPx = wellDepthMm | ||
? roundedPixelsFromBottom * 2 | ||
: mmFromBottom - WELL_HEIGHT_PIXELS | ||
|
||
const xPositionPixels = (WELL_WIDTH_PIXELS / xWidthMm) * xPosition | ||
const roundedXPositionPixels = round(xPositionPixels, PIXEL_DECIMALS) | ||
|
||
return ( | ||
<Box | ||
position={POSITION_RELATIVE} | ||
width="15.8125rem" | ||
height="18rem" | ||
overflow={OVERFLOW_HIDDEN} | ||
> | ||
<img src={BOTTOM_LAYER} style={{ position: POSITION_ABSOLUTE }} /> | ||
<img | ||
src={MID_LAYER} | ||
style={{ | ||
position: POSITION_ABSOLUTE, | ||
transform: `translate(${roundedXPositionPixels}px)`, | ||
bottom: `calc(${bottomPx}px + 33px)`, | ||
}} | ||
/> | ||
<img src={TOP_LAYER} style={{ position: POSITION_ABSOLUTE }} /> | ||
{wellDepthMm !== null && ( | ||
<Box position={POSITION_ABSOLUTE} bottom="7.3rem" right="2rem"> | ||
<StyledText desktopStyle="captionRegular" color={COLORS.grey60}> | ||
{round(wellDepthMm, 0)} | ||
{t('units.millimeter')} | ||
</StyledText> | ||
</Box> | ||
)} | ||
{xWidthMm !== null && ( | ||
<Box position={POSITION_ABSOLUTE} bottom="2rem" right="7rem"> | ||
<StyledText desktopStyle="captionRegular" color={COLORS.grey60}> | ||
{xWidthMm} | ||
{t('units.millimeter')} | ||
</StyledText> | ||
</Box> | ||
)} | ||
</Box> | ||
) | ||
} |
Oops, something went wrong.