Skip to content

Commit

Permalink
add OT-2 deck location select story
Browse files Browse the repository at this point in the history
  • Loading branch information
brenthagen committed Dec 13, 2023
1 parent 0ea60cc commit f0ce76c
Showing 1 changed file with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,49 @@ import { DeckLocationSelect as DeckLocationSelectComponent } from './'
import {
FLEX_ROBOT_TYPE,
getDeckDefFromRobotType,
OT2_ROBOT_TYPE,
} from '@opentrons/shared-data'

import type { Meta, StoryObj } from '@storybook/react'
import type { RobotType } from '@opentrons/shared-data'

const meta: Meta<React.ComponentProps<typeof DeckLocationSelectComponent>> = {
component: DeckLocationSelectComponent,
title: 'Library/Molecules/Simulation/SelectDeckLocation',
} as Meta

export default meta
type Story = StoryObj<{ disabledSlotNames: string[] }>
type Story = StoryObj<{ disabledSlotNames: string[]; robotType: RobotType }>

export const DeckLocationSelect: Story = {
export const FlexDeckLocationSelect: Story = {
render: args => {
return <Wrapper {...args} />
},
args: {
disabledSlotNames: ['A2'],
robotType: FLEX_ROBOT_TYPE,
},
}

function Wrapper(props: { disabledSlotNames: string[] }): JSX.Element {
export const OT2DeckLocationSelect: Story = {
render: args => {
return <Wrapper {...args} />
},
args: {
disabledSlotNames: ['2'],
robotType: OT2_ROBOT_TYPE,
},
}

function Wrapper(props: {
disabledSlotNames: string[]
robotType: RobotType
}): JSX.Element {
const [selectedLocation, setSelectedLocation] = React.useState({
slotName: 'A1',
slotName: props.robotType === FLEX_ROBOT_TYPE ? 'A1' : '1',
})

const deckDef = getDeckDefFromRobotType(FLEX_ROBOT_TYPE)
const deckDef = getDeckDefFromRobotType(props.robotType)
return (
<DeckLocationSelectComponent
{...{ selectedLocation, setSelectedLocation, deckDef }}
Expand Down

0 comments on commit f0ce76c

Please sign in to comment.