import IconPhoneGray from "@/components/icon/IconPhoneGray";
import IconPhoneBlue from "@/components/icon/IconPhoneBlue";
import IconMailGray from "@/components/icon/IconMailGray";
import IconMailBlue from "@/components/icon/IconMailBlue";
import IconLocationGray from "@/components/icon/IconLocationGray";
import IconLocationBlue from "@/components/icon/IconLocationBlue";
import IconQrcodeBlue from "@/components/icon/IconQrcodeBlue";
import IconQrcodeGray from "@/components/icon/IconQrcodeGray";
import style from './index.module.less'
import { View } from "@tarojs/components";

export interface IndexProps {
  type: 'phone'|'mail'|'location'|'qrcode'
  actived: boolean
}

const Index = ({ type, actived }: IndexProps) => {
  const getIcon = ()=> {
    if(type === 'phone'){
      return actived ? <IconPhoneBlue/> : <IconPhoneGray />
    }
    if(type === 'mail'){
      return actived ? <IconMailBlue/> : <IconMailGray />
    }
    if(type === 'location'){
      return actived ? <IconLocationBlue/> : <IconLocationGray />
    }
    if(type === 'qrcode'){
      return actived ? <IconQrcodeBlue/> : <IconQrcodeGray />
    }
  }
  return <View className={actived ? style.iconActive : style.icon}>{getIcon()}</View>
}

export default Index;