import { StyleSheet, Text, View } from 'react-native'
import React from 'react'
import { SWIFT_BYTE_COLOURS } from '../../../constants'
import Feather from 'react-native-vector-icons/Feather'
import { TextInput } from './TextInput'

interface SearchBarProps{
  value: string
  onChangeText: (value:string) => void
  placeholder: string
}

export function SearchBar(props: SearchBarProps) {
  return (
    <View style={styles.container}>
      <Feather name="search" size={20} color={SWIFT_BYTE_COLOURS.GRAY} style={styles.icon}/>
      <TextInput 
        style={styles.input}
        placeholder={props.placeholder} 
        value={props.value} 
        onChangeText={props.onChangeText}
        />

    </View>
  )
}

const styles = StyleSheet.create({
  container:{
    flexDirection:"row",
    alignItems: 'center',
    borderWidth:1,
    borderColor:SWIFT_BYTE_COLOURS.GRAY,
    borderRadius: 30,
    height:60,
    width:"80%",

  },
  input:{
    paddingLeft:0,
    borderWidth:0,
    color:"black",
  },
  icon:{
    marginLeft:20,
    marginRight:10
  }
})