From 6f376af9c33ba3f76614b0c6ee11f6e6a4717f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A7=D0=B8=D0=BA=D0=B0=D0=BB=D0=BA=D0=B8=D0=BD?= Date: Fri, 4 Sep 2020 10:07:41 +0300 Subject: [PATCH] create Radio --- src/client/Elements/Radio.jsx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/client/Elements/Radio.jsx diff --git a/src/client/Elements/Radio.jsx b/src/client/Elements/Radio.jsx new file mode 100644 index 0000000..b60013f --- /dev/null +++ b/src/client/Elements/Radio.jsx @@ -0,0 +1,31 @@ +import { Radio as AntRadio } from 'antd'; +import { useOptions } from 'client/hooks/useOptions'; +import { useStatus } from 'client/hooks/useStatus'; +import { useStoreValue } from 'client/hooks/useStoreValue'; +import { Status } from 'core/types/elements'; +import { observer } from 'mobx-react'; +import React from 'react'; + +const Radio = ({ name, buttonStyle, computedValue, valueName }) => { + const { value, setCurrentValue } = useStoreValue({ + computedValue, + valueName, + }); + const { status } = useStatus(name); + const { options } = useOptions(name); + + return ( + setCurrentValue(e.target.value)} + > + {options.map((option, i) => ( + {option.name} + ))} + + ); +}; + +export default observer(Radio);