Skip to content
Merged
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 @@ -7,6 +7,7 @@ import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -132,7 +133,9 @@ private fun Modifier.buttonContainer(
config: PrezelButtonDefault,
): Modifier =
this
.clip(shape = config.shape)
.then(
config.textButtonHeight?.let { Modifier.height(it) } ?: Modifier,
).clip(shape = config.shape)
.background(color = config.backgroundColor(enabled = enabled))
.then(
if (config.hasBorder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ data class PrezelButtonDefault(
val contentPadding: PaddingValues,
val iconSpacing: Dp,
val iconSize: Dp,
val textButtonHeight: Dp?,
) {
val hasBorder: Boolean = borderWidth > 0.dp

Expand Down Expand Up @@ -66,6 +67,7 @@ object PrezelButtonDefaults {
contentPadding: PaddingValues = getContentPadding(size = size, isIconOnly = isIconOnly),
iconSpacing: Dp = getIconSpacing(size = size),
iconSize: Dp = getIconSize(size = size),
textButtonHeight: Dp? = if (isIconOnly) null else getTextButtonHeight(size = size),
) = PrezelButtonDefault(
contentColor = contentColor,
disabledContentColor = disabledContentColor,
Expand All @@ -79,8 +81,17 @@ object PrezelButtonDefaults {
contentPadding = contentPadding,
iconSpacing = iconSpacing,
iconSize = iconSize,
textButtonHeight = textButtonHeight,
)

@Composable
private fun getTextButtonHeight(size: ButtonSize): Dp =
when (size) {
ButtonSize.XSMALL -> 28.dp
ButtonSize.SMALL -> 36.dp
ButtonSize.REGULAR -> 48.dp
}

@Composable
private fun getContentColor(
type: ButtonType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ value class Nickname private constructor(
companion object {
const val MAX_LENGTH = 10
private const val MIN_LENGTH = 2
private const val DIGIT_START = '0'.code
private const val DIGIT_END = '9'.code
private const val LATIN_UPPERCASE_START = 'A'.code
private const val LATIN_UPPERCASE_END = 'Z'.code
private const val LATIN_LOWERCASE_START = 'a'.code
Expand All @@ -46,7 +48,8 @@ value class Nickname private constructor(
}

private fun isAllowedCodePoint(codePoint: Int): Boolean =
codePoint in LATIN_UPPERCASE_START..LATIN_UPPERCASE_END ||
codePoint in DIGIT_START..DIGIT_END ||
codePoint in LATIN_UPPERCASE_START..LATIN_UPPERCASE_END ||
codePoint in LATIN_LOWERCASE_START..LATIN_LOWERCASE_END ||
Character.UnicodeScript.of(codePoint) == Character.UnicodeScript.HANGUL
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private fun ProfileScreen(
)

PrezelButtonArea(
showBackground = true,
showBackground = false,
modifier = Modifier.advancedImePadding(),
mainButton = { modifier ->
PrezelButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.team.prezel.core.designsystem.component.textfield.PrezelTextField
import com.team.prezel.core.designsystem.component.textfield.PrezelTextFieldStatus
import com.team.prezel.core.designsystem.preview.BasicPreview
import com.team.prezel.core.designsystem.theme.PrezelTheme
import com.team.prezel.core.model.profile.Nickname
import com.team.prezel.feature.profile.impl.R
import com.team.prezel.feature.profile.impl.model.NicknameValidationState

Expand All @@ -29,6 +30,7 @@ internal fun NicknameTextField(
label = stringResource(R.string.feature_profile_impl_nickname_text_field_label),
placeholder = stringResource(R.string.feature_profile_impl_nickname_text_field_placeholder),
status = nicknameValidationState.toNicknameStatus(),
maxLength = Nickname.MAX_LENGTH,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
),
Expand Down