import { View, Image } from "@tarojs/components";
import './Switch2.scss'
import { rpxToPx } from "@/utils/tools";
export default function Component(props: { isOn: boolean, onClick: Function }) {
    // alert('aa')
    if (process.env.TARO_ENV == 'weapp') {
        return <View className="switch1" style={{ backgroundColor: global.isDebug ? 'blue' : 'transparent' }} onClick={(e) => {
            if (process.env.TARO_ENV == 'weapp') {
                e.stopPropagation()
            }; props.onClick()
        }}>

            {
                props.isOn ? <Image src={require('@/assets/images/bell.png')} style={{ height: rpxToPx(56), width: rpxToPx(56) }} /> :
                    <Image src={require('@/assets/images/switch_off.png')} style={{ height: rpxToPx(56), width: rpxToPx(92) }} />
            }

            {/* <Image className="switch2" style={{ backgroundColor:'blue' }}
                src={require(props.isOn ? '@/assets/images/switch.png' : '@/assets/images/switch.png')} /> */}
        </View>
    }
    return <View className="switch1" style={{ backgroundColor: global.isDebug ? 'blue' : 'transparent' }} onClick={(e) => {
         props.onClick()
    }}>

        {
            props.isOn ? <Image src={require('@/assets/images/bell.png')} style={{ height: rpxToPx(56), width: rpxToPx(56) }} /> :
                <Image src={require('@/assets/images/switch_off.png')} style={{ height: rpxToPx(56), width: rpxToPx(92) }} />
        }

        {/* <Image className="switch2" style={{ backgroundColor:'blue' }}
            src={require(props.isOn ? '@/assets/images/switch.png' : '@/assets/images/switch.png')} /> */}
    </View>


}