Skip to content

Commit a336ea7

Browse files
authored
fix(components): fix Module storybook (#18962)
* fix(components): fix Module storybook
1 parent 963067f commit a336ea7

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

components/src/hardware-sim/Module/Module.stories.tsx

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import {
2+
ABSORBANCE_READER_V1,
23
fixture96Plate,
4+
FLEX_STACKER_MODULE_V1,
35
getModuleDef,
46
HEATERSHAKER_MODULE_V1,
57
MAGNETIC_BLOCK_V1,
@@ -27,8 +29,23 @@ const moduleModels: ModuleModel[] = [
2729
MAGNETIC_MODULE_V2,
2830
HEATERSHAKER_MODULE_V1,
2931
MAGNETIC_BLOCK_V1,
32+
ABSORBANCE_READER_V1,
33+
FLEX_STACKER_MODULE_V1,
3034
]
3135

36+
const moduleModelOptions = {
37+
'Temperature Module V2': TEMPERATURE_MODULE_V2,
38+
'Temperature Module V1': TEMPERATURE_MODULE_V1,
39+
'Thermocycler Module V1': THERMOCYCLER_MODULE_V1,
40+
'Thermocycler Module V2': THERMOCYCLER_MODULE_V2,
41+
'Magnetic Module V1': MAGNETIC_MODULE_V1,
42+
'Magnetic Module V2': MAGNETIC_MODULE_V2,
43+
'Heater-Shaker Module V1': HEATERSHAKER_MODULE_V1,
44+
'Magnetic Block V1': MAGNETIC_BLOCK_V1,
45+
'Absorbance Reader V1': ABSORBANCE_READER_V1,
46+
'Flex Stacker Module V1': FLEX_STACKER_MODULE_V1,
47+
}
48+
3249
export default {
3350
title: 'Library/Molecules/Simulation/Module',
3451
} as Meta
@@ -39,53 +56,65 @@ const Template: Story<{
3956
hasLabware: boolean
4057
innerProps: {}
4158
}> = args => {
59+
// Add null check and default to first module model if undefined
60+
const moduleModel = args.model || moduleModels[0]
61+
4262
return (
4363
<RobotCoordinateSpace height="100vh" width="100vw" viewBox="0 -50 200 320">
4464
<ModuleComponent
45-
def={getModuleDef(args.model)}
65+
def={getModuleDef(moduleModel)}
4666
x={0}
4767
y={0}
4868
innerProps={args.innerProps}
4969
orientation={args.orientation}
70+
targetSlotId={null}
71+
targetDeckId={null}
5072
>
5173
{args.hasLabware ? (
52-
<LabwareRender definition={fixture96Plate as LabwareDefinition} />
74+
<LabwareRender
75+
definition={fixture96Plate as LabwareDefinition}
76+
positioningMode="passThrough"
77+
/>
5378
) : null}
5479
</ModuleComponent>
5580
</RobotCoordinateSpace>
5681
)
5782
}
83+
5884
export const Module = Template.bind({})
85+
Module.args = {
86+
model: TEMPERATURE_MODULE_V2,
87+
orientation: 'left',
88+
hasLabware: false,
89+
innerProps: {
90+
lidMotorState: 'open',
91+
blockTargetTemp: 90,
92+
targetTemperature: 4,
93+
targetTemp: 40,
94+
},
95+
}
96+
5997
Module.argTypes = {
6098
model: {
6199
control: {
62100
type: 'select',
63-
options: moduleModels,
64101
},
65-
defaultValue: moduleModels[0],
102+
options: moduleModelOptions,
66103
},
67104
orientation: {
68105
control: {
69106
type: 'select',
70-
options: ['left', 'right'],
71107
},
72-
defaultValue: 'left',
108+
options: ['left', 'right'],
73109
},
74110
hasLabware: {
75111
control: {
76112
type: 'boolean',
77113
},
78-
defaultValue: false,
79114
},
80115
innerProps: {
81116
control: {
82117
type: 'object',
83118
},
84-
defaultValue: {
85-
lidMotorState: 'open',
86-
blockTargetTemp: 90,
87-
targetTemperature: 4,
88-
targetTemp: 40,
89-
},
90119
},
91120
}

0 commit comments

Comments
 (0)