refactor inputs
This commit is contained in:
1 parent
2c5d64ab86
commit
549f52655b
45 files changed
+301
-256
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { Page } from "components/Page";
|
||||
import { useState } from "react";
|
||||
|
||||
import { InputDevice } from "./InputDevice";
|
||||
|
||||
export default {
|
||||
title: 'Inputs/InputDevice',
|
||||
component: InputDevice,
|
||||
parameters: { actions: { argTypesRegex: '^on.*' } },
|
||||
argTypes: {}
|
||||
} as ComponentMeta<typeof InputDevice>;
|
||||
|
||||
|
||||
|
||||
const Template: ComponentStory<typeof InputDevice> = args => {
|
||||
const [value, setValue] = useState(args.value)
|
||||
return <Page>
|
||||
<div style={{
|
||||
maxWidth: 200
|
||||
}}>
|
||||
<InputDevice {...args} value={value as any} onChange={(v: any) => {
|
||||
setValue(v)
|
||||
args.onChange(v as any)
|
||||
}} />
|
||||
</div>
|
||||
</Page>
|
||||
|
||||
}
|
||||
|
||||
export const Single = Template.bind({})
|
||||
Single.args = {
|
||||
...Single.args,
|
||||
multiple: false,
|
||||
value: 'sensor.humidity_bathroom'
|
||||
} as any
|
||||
Reference in new issue
Block a user