package com.example.mystictale.resources

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.mystictale.ui.theme.OpenSans

@Composable
fun GenericTextField(value:String, onValue:(String) -> Unit,placeholder:String, keyboardType:KeyboardType) {
    TextField(
        value = value,
        onValueChange = onValue,
        Modifier
            .fillMaxWidth(0.95f)
            .padding(horizontal = 20.dp),
        keyboardOptions = KeyboardOptions(
            keyboardType = keyboardType
        ),
        colors = TextFieldDefaults.colors(
            unfocusedTextColor = Color.White,
            unfocusedPlaceholderColor = Color(0xffA1A0A3),
            unfocusedContainerColor = Color.Transparent,
            focusedTextColor = Color.White,
            focusedContainerColor = Color.Transparent,
            focusedPlaceholderColor = Color(0xffA1A0A3),
            focusedIndicatorColor = Color(0xff28176B),
            unfocusedIndicatorColor = Color(0xff28176B)
        ),
        placeholder = { Text(text = placeholder) },
        maxLines = 1,
        textStyle = TextStyle(
            fontFamily = OpenSans,
            fontWeight = FontWeight.Light,
            fontSize = 15.sp
        )
    )
}