import React, { useState } from 'react'; import { IOTSwitchProps } from './interface'; import './style/index.less'; const prefixCls = 'iot-switch-out'; import NormalIcon from '../../base/normalIcon'; const IOTSwitch: React.FC = ({ streamId, subTitle, title, curValue, disabled = false, icon, streamName, handler = (val: any) => { }, ...rest }) => { // const [checked, setchecked] = useState(true); // const getIcon = () => { // if (icon?.show) { // return ( // // ); // } // return undefined; // }; // const getContent = () => { // return ( // <> // {getIcon()} //
//
//
{title}
// {subTitle?.show ?
{subTitle?.value}
: undefined} //
//
// // ); // }; return ( <>
{ icon?.show && (
) }
{ title }
{ subTitle?.show && (
{ subTitle['value']}
) }
{ const item: any = { value: !curValue, streamId, }; handler(item); }}>
{disabled && (
)}
{/* {getContent()}
{ const item = { value: !curValue, streamId, }; handler(item); }} >
*/}
); }; export default IOTSwitch;