package com.example.shawarma.widgets

import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.material.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.Placeholder
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.shawarma.ui.theme.JejuFamily
import com.example.shawarma.ui.theme.MyTextFieldBackground

@Composable
fun MyTextField(
    text: MutableState<TextFieldValue>,
    onTextChanged: (TextFieldValue) -> Unit,
    modifier: Modifier,
    placeholder: String,
    singleLine: Boolean
) {
    return TextField(
        value = text.value,
        onValueChange = onTextChanged,
        placeholder = {
            Text(
                text = placeholder,
                fontSize = 16.sp,
                style = TextStyle(
                    fontFamily = JejuFamily
                )
            )
        },
        singleLine = singleLine,
        shape = RoundedCornerShape(20.dp),
        textStyle = TextStyle(
            fontSize = 16.sp,
            fontFamily = JejuFamily
        ),
        colors = TextFieldDefaults.textFieldColors(
            textColor = Color.Black,
            disabledTextColor = Color.Transparent,
            backgroundColor = MyTextFieldBackground,
            focusedIndicatorColor = Color.Transparent,
            unfocusedIndicatorColor = Color.Transparent,
            disabledIndicatorColor = Color.Transparent
        ),
        modifier = modifier
    )
}