Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 텍스트필드 패딩 화면 비율에 맞게 변경 #304

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import androidx.compose.foundation.border
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsFocusedAsState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
Expand All @@ -24,7 +23,6 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.teamoffroad.core.designsystem.theme.ErrorNew
import com.teamoffroad.core.designsystem.theme.Gray100
Expand All @@ -40,7 +38,7 @@ fun BirthDateTextField(
placeholder: String = "",
value: String = "",
onValueChange: (String) -> Unit = { _ -> },
innerPadding: Dp,
innerPadding: Float,
maxLines: Int = 1,
minLines: Int = 1,
maxLength: Int,
Expand Down Expand Up @@ -91,8 +89,9 @@ fun BirthDateTextField(
keyboardActions = keyboardActions,
visualTransformation = visualTransformation,
decorationBox = { innerText ->
Column(
Row(
modifier = Modifier
.fillMaxWidth()
.background(
color = White,
shape = shape
Expand All @@ -101,34 +100,27 @@ fun BirthDateTextField(
width = 1.dp,
color = borderLineColor.value,
shape = shape,
)
.wrapContentWidth()
.padding(vertical = 12.dp),
),
verticalAlignment = Alignment.CenterVertically
) {
Spacer(modifier = Modifier.weight(innerPadding))
Box(
modifier = Modifier,
contentAlignment = Alignment.CenterStart,
modifier = Modifier
.weight(0.4f),
contentAlignment = Alignment.CenterStart
) {
if (value.isEmpty()) {
Text(
text = placeholder,
color = Gray300,
style = textStyle,
maxLines = 1,
modifier = Modifier
.align(Alignment.Center)
.wrapContentWidth(),
)
}
Box(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = innerPadding)
) {
innerText()
}
innerText()
}
Spacer(modifier = Modifier.weight(0.6f - innerPadding))
}
},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.teamoffroad.core.designsystem.theme.Gray100
import com.teamoffroad.core.designsystem.theme.Gray300
import com.teamoffroad.core.designsystem.theme.Main3
import com.teamoffroad.core.designsystem.theme.NametagInactive
import com.teamoffroad.core.designsystem.theme.OffroadTheme
import com.teamoffroad.core.designsystem.theme.Sub

@Composable
Expand Down Expand Up @@ -47,6 +48,7 @@ fun GenderHintButton(
.padding(vertical = 18.dp),
text = value,
color = contentColor,
style = OffroadTheme.typography.textAuto,
textAlign = TextAlign.Center,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ internal fun BirthDateScreen(
updateYear(it)
}
},
innerPadding = 30.dp,
innerPadding = 0.3f,
maxLength = 4,
isError = uiState.yearValidateResult == DateValidateResult.Error,
keyboardOptions = KeyboardOptions.Default.copy(
Expand Down Expand Up @@ -117,7 +117,7 @@ internal fun BirthDateScreen(
updateMonth(it)
}
},
innerPadding = 23.dp,
innerPadding = 0.34f,
maxLength = 2,
isError = uiState.monthValidateResult == DateValidateResult.Error,
keyboardOptions = KeyboardOptions.Default.copy(
Expand Down Expand Up @@ -150,7 +150,7 @@ internal fun BirthDateScreen(
updateDate(it)
}
},
innerPadding = 23.dp,
innerPadding = 0.34f,
maxLength = 2,
isError = uiState.dayValidateResult == DateValidateResult.Error,
keyboardOptions = KeyboardOptions.Default.copy(
Expand Down