Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components,-protocol-designer): fix order and border radius logic for DeckLabelSet #17230

Open
wants to merge 1 commit into
base: edge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions components/src/organisms/DeckLabelSet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ const StyledBox = styled(Box)<StyledBoxProps>`

const LabelContainer = styled.div`
padding-left: ${SPACING.spacing12};
& > *:not(:first-child):not(:last-child) {

& > *:first-child {
border-bottom-right-radius: ${BORDERS.borderRadius4};
border-top-right-radius: ${BORDERS.borderRadius4};
}

& > *:first-child {
& > *:not(:first-child) {
border-top-right-radius: ${BORDERS.borderRadius4};
border-bottom-right-radius: ${BORDERS.borderRadius4};
}

& > *:last-child {
border-bottom-left-radius: ${BORDERS.borderRadius4};
border-bottom-right-radius: ${BORDERS.borderRadius4};
}
`
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ export const ModuleLabel = (props: ModuleLabelProps): JSX.Element => {
<DeckLabelSet
ref={labelContainerRef}
deckLabels={[
...labwareInfos,
{
text: labelName ?? def?.displayName,
isSelected,
isLast,
moduleModel: def?.model,
isZoomed: isZoomed,
},
...labwareInfos,
]}
x={
position[0] +
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

props in this component aren't optional so I recommend you use === / !== instead of ==/!=

Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,20 @@ export const SelectedHoveredItems = (
const labwareInfos: DeckLabelProps[] = []

if (
selectedLabwareDefUri != null &&
(hoveredLabware == null || hoveredLabware !== selectedLabwareDefUri)
(hoveredLabware != null ||
selectedLabwareDefUri === hoveredLabware ||
selectedNestedLabwareDefUri === hoveredLabware) &&
hoveredLabwareDef != null
) {
const def =
defs[selectedLabwareDefUri] ?? customLabwareDefs[selectedLabwareDefUri]
const selectedLabwareLabel = {
text: def.metadata.displayName,
isSelected: true,
isLast: hoveredLabware == null && selectedNestedLabwareDefUri == null,
const hoverLabelLabel = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hoverLabwareLabel?

text: hoveredLabwareDef.metadata.displayName,
isSelected: false,
isLast: true,
isZoomed: true,
}
labwareInfos.push(selectedLabwareLabel)
labwareInfos.push(hoverLabelLabel)
}

if (selectedNestedLabwareDef != null && hoveredLabware == null) {
const selectedNestedLabwareLabel = {
text: selectedNestedLabwareDef.metadata.displayName,
Expand All @@ -129,18 +130,18 @@ export const SelectedHoveredItems = (
labwareInfos.push(selectedNestedLabwareLabel)
}
if (
(hoveredLabware != null ||
selectedLabwareDefUri === hoveredLabware ||
selectedNestedLabwareDefUri === hoveredLabware) &&
hoveredLabwareDef != null
selectedLabwareDefUri != null &&
(hoveredLabware == null || hoveredLabware !== selectedLabwareDefUri)
) {
const hoverLabelLabel = {
text: hoveredLabwareDef.metadata.displayName,
isSelected: false,
isLast: true,
const def =
defs[selectedLabwareDefUri] ?? customLabwareDefs[selectedLabwareDefUri]
const selectedLabwareLabel = {
text: def.metadata.displayName,
isSelected: true,
isLast: hoveredLabware == null && selectedNestedLabwareDefUri == null,
isZoomed: true,
}
labwareInfos.push(hoverLabelLabel)
labwareInfos.push(selectedLabwareLabel)
}

return (
Expand Down
Loading