Skip to content

Commit

Permalink
fix lint and also remove bug addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Jul 31, 2023
1 parent 3996f66 commit 1b3ff7a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion components/src/forms/DropdownField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import cx from 'classnames'

import { Icon, truncateString } from '..'
import { Icon } from '..'
import styles from './forms.css'

export interface DropdownOption {
Expand Down
21 changes: 15 additions & 6 deletions components/src/forms/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import ReactSelect, {
import cx from 'classnames'

import { Icon } from '../icons'
import { Box } from '../primitives'
import { SPACING } from '../ui-style-constants'
import { POSITION_ABSOLUTE, POSITION_FIXED } from '../styles'
import styles from './Select.css'

Expand Down Expand Up @@ -113,13 +115,20 @@ function DropdownIndicator(
): JSX.Element {
return (
<reactSelectComponents.DropdownIndicator {...props}>
<div
className={cx(styles.dropdown_indicator, {
[styles.flipped]: props.selectProps.menuIsOpen,
})}
<Box
position={POSITION_ABSOLUTE}
top="0.25rem"
right={SPACING.spacing8}
width={SPACING.spacing20}
>
<Icon name="menu-down" className={cx(styles.dropdown_indicator_icon)} />
</div>
<Icon
name="menu-down"
transform={`rotate(${
props.selectProps.menuIsOpen === true ? '180' : '0'
})`}
height="1.25rem"
/>
</Box>
</reactSelectComponents.DropdownIndicator>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import { connect } from 'react-redux'
import { LabwareNameOverlay, truncateString } from '@opentrons/components'
import { LabwareNameOverlay } from '@opentrons/components'
import { getLabwareDisplayName } from '@opentrons/shared-data'
import { BaseState } from '../../../types'
import { selectors as uiLabwareSelectors } from '../../../ui/labware'
Expand All @@ -17,9 +17,7 @@ type Props = OP & SP

const NameOverlay = (props: Props): JSX.Element => {
const { labwareOnDeck, nickname } = props
const truncatedNickName =
nickname != null ? truncateString(nickname, 75, 25) : null
const title = truncatedNickName ?? getLabwareDisplayName(labwareOnDeck.def)
const title = nickname || getLabwareDisplayName(labwareOnDeck.def)
return <LabwareNameOverlay title={title} />
}

Expand Down
11 changes: 2 additions & 9 deletions protocol-designer/src/components/LiquidsSidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import * as React from 'react'
import { connect } from 'react-redux'
import { i18n } from '../../localization'
import {
DeprecatedPrimaryButton,
SidePanel,
truncateString,
} from '@opentrons/components'
import { DeprecatedPrimaryButton, SidePanel } from '@opentrons/components'
import { PDTitledList } from '../lists'
import { swatchColors } from '../swatchColors'
import listButtonStyles from '../listButtons.css'
Expand Down Expand Up @@ -47,10 +43,7 @@ function LiquidsSidebarComponent(props: Props): JSX.Element {
className: styles.liquid_icon_container,
},
}}
title={
truncateString(name ?? '', 25) ??
`Unnamed Ingredient ${ingredientId}`
} // fallback, should not happen
title={name || `Unnamed Ingredient ${ingredientId}`} // fallback, should not happen
/>
))}
<div className={listButtonStyles.list_item_button}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import cx from 'classnames'
import { DropdownField, Options, truncateString } from '@opentrons/components'
import { DropdownField, Options } from '@opentrons/components'
import styles from '../StepEditForm.css'
import type { StepFieldName } from '../../../steplist/fieldLevel'
import type { FieldProps } from '../types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react'
import cx from 'classnames'
import { FormGroup } from '@opentrons/components'
import { i18n } from '../../../../localization'
import {
VolumeField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const ModelDropdown = (props: ModelDropdownProps): JSX.Element => {
tabIndex={tabIndex}
options={options}
name={fieldName}
value={options.length === 1 ? String(options[0].value) : ''}
value={field.value}
onChange={field.onChange}
onBlur={field.onBlur}
error={meta.touched && meta.error ? meta.error : null}
Expand Down

0 comments on commit 1b3ff7a

Please sign in to comment.