// withHooks
// noPage

import { LibStyle } from 'esoftplay/cache/lib/style/import';

import React from 'react';
import { TouchableOpacity, View } from 'react-native';


export interface MarketToggleProps {
  value: boolean,
  type: "success" | "danger"
  disabled?: boolean,
  onChangeValue: () => void
}
export default function m(props: MarketToggleProps): any {
  const { value, type, onChangeValue } = props
  const color = type == 'success' ? "#4CD964" : "#E6212A"

  return (
    <TouchableOpacity
      testID='toggle'
      disabled={props.disabled}
      onPress={onChangeValue}
      style={{ opacity: props.disabled ? 0.5 : 1, height: 30, width: 50, borderWidth: 2, borderColor: value ? color : "#f1f2f3", borderRadius: 15, backgroundColor: value ? color : "white", justifyContent: "center", paddingHorizontal: 0.5, alignItems: value ? "flex-end" : "flex-start" }} >
      <View style={{ height: 26, width: 26, borderRadius: 13, backgroundColor: "white", ...LibStyle.elevation(2) }} />
    </TouchableOpacity>
  )
}