package com.example.myapplication.components.common

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.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.input.PasswordVisualTransformation
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp


@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun myInput(label: String, text: MutableState<String>, height: Dp = 50.dp, modifier: Modifier = Modifier) {
    Column(modifier=modifier) {
        Text(label)
        TextField(
            value = text.value,
            onValueChange = {newText -> text.value = newText},
            colors= TextFieldDefaults.outlinedTextFieldColors(
                focusedBorderColor = Color.Transparent,
                disabledBorderColor = Color.Transparent,
                unfocusedBorderColor = Color.Transparent,
                errorBorderColor = Color.Transparent
            ),
            modifier = Modifier
                .border(1.dp, Color.Black, RoundedCornerShape(5.dp))
                .fillMaxWidth()
                .height(height),
        )
    }
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun passwordInput(label: String, text: MutableState<String>, height: Dp = 50.dp, modifier: Modifier = Modifier) {
    Column(modifier=modifier) {
        Text(label)
        TextField(
            value = text.value,
            onValueChange = {newText -> text.value = newText},
            colors= TextFieldDefaults.outlinedTextFieldColors(
                focusedBorderColor = Color.Transparent,
                disabledBorderColor = Color.Transparent,
                unfocusedBorderColor = Color.Transparent,
                errorBorderColor = Color.Transparent
            ),
            visualTransformation = PasswordVisualTransformation(),
            modifier = Modifier
                .border(1.dp, Color.Black, RoundedCornerShape(5.dp))
                .fillMaxWidth()
                .height(height),
        )
    }
}

