Skip to content

Commit

Permalink
[MERGE] #241 -> develop
Browse files Browse the repository at this point in the history
[FIX/#241] 유빈 담당 뷰 / 1차 QA 반영
  • Loading branch information
leeeyubin authored Sep 16, 2024
2 parents 20dfc25 + ad86cc9 commit 2635fb5
Show file tree
Hide file tree
Showing 41 changed files with 750 additions and 217 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.terning.core.designsystem.component.bottomsheet

import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand All @@ -27,10 +26,10 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.terning.core.R
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable
import com.terning.core.type.ProfileImage
import com.terning.core.type.SelectedProfileImage
import kotlinx.coroutines.launch

/**
Expand Down Expand Up @@ -98,7 +97,6 @@ fun RadioButtonGroup(
modifier: Modifier = Modifier,
) {
val options = ProfileImage.entries

var selectedOptionIndex by rememberSaveable {
mutableIntStateOf(ProfileImage.toIndex(ProfileImage.fromString(initialSelectedOption)))
}
Expand All @@ -110,29 +108,23 @@ fun RadioButtonGroup(
modifier = modifier.padding(horizontal = 34.dp)
) {
itemsIndexed(options.take(6)) { index, option ->
val imageModifier = if (selectedOptionIndex == index) {
Modifier
.border(
color = TerningMain,
width = 2.dp,
shape = CircleShape
)
.aspectRatio(1f)
} else {
Modifier.aspectRatio(1f)
val isSelected = selectedOptionIndex == index
val imageResId = when {
isSelected -> SelectedProfileImage.entries[index].drawableResId
else -> option.drawableResId
}

Image(
painter = painterResource(id = option.drawableResId),
painter = painterResource(id = imageResId),
contentDescription = "profile image",
modifier = imageModifier
modifier = Modifier
.aspectRatio(1f)
.noRippleClickable {
onOptionSelected(option)
selectedOptionIndex = index
}
.clip(shape = CircleShape)
.size(76.dp)
.aspectRatio(1f)
.size(76.dp),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import com.terning.core.R
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.Grey375
import com.terning.core.designsystem.theme.Grey50
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.designsystem.theme.TerningSub5
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.util.NoRippleTheme
Expand Down Expand Up @@ -56,15 +58,19 @@ fun FilteringButton(
) {
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
val backgroundColor = White
val backgroundColor = when {
!isSelected && isPressed -> Grey50
isSelected && isPressed -> TerningSub5
else -> White
}
val textColor = when {
!isSelected -> Grey375
isPressed -> Grey375
!isSelected && !isPressed -> Grey375
!isSelected && isPressed -> Grey375
else -> TerningMain
}
val borderColor = when {
!isSelected && !isPressed -> Grey150
isPressed -> Grey200
!isSelected && isPressed -> Grey200
else -> TerningMain
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data class NameFieldState(
val helperMessage: Int,
val helperIcon: Int?,
val helperColor: Color,
val isValid: Boolean
val isButtonValid: Boolean
)

@Composable
Expand All @@ -35,7 +35,8 @@ fun NameTextField(
hint: String,
modifier: Modifier = Modifier,
onValidationChanged: (Boolean) -> Unit,
initialView: Boolean = false
initialView: Boolean = false,
isProfileChangedButNameSame: Boolean = false,
) {
val focusManager = LocalFocusManager.current
val keyboardController = LocalSoftwareKeyboardController.current
Expand All @@ -44,7 +45,7 @@ fun NameTextField(
val trimmedName: String
var isNameOutOfBounds = false
if (value.length > MAX_LENGTH) {
trimmedName = value.substring(0, MAX_LENGTH)
trimmedName = value.substring(0, MAX_LENGTH + 1)
isNameOutOfBounds = true
} else {
trimmedName = value
Expand All @@ -58,7 +59,18 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper,
helperIcon = R.drawable.ic_name_text_field_check,
helperColor = White,
isValid = false
isButtonValid = false
)
}

isProfileChangedButNameSame -> {
NameFieldState(
name = trimmedName,
lineColor = Grey500,
helperMessage = R.string.sign_up_helper,
helperIcon = R.drawable.ic_name_text_field_check,
helperColor = White,
isButtonValid = true
)
}

Expand All @@ -69,7 +81,7 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper_error,
helperIcon = R.drawable.ic_name_text_field_error,
helperColor = WarningRed,
isValid = false
isButtonValid = false
)
}

Expand All @@ -80,7 +92,7 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper,
helperIcon = null,
helperColor = Grey400,
isValid = false
isButtonValid = false
)
}

Expand All @@ -91,7 +103,7 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper_out,
helperIcon = R.drawable.ic_name_text_field_error,
helperColor = WarningRed,
isValid = false
isButtonValid = false
)
}

Expand All @@ -102,19 +114,19 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper_available,
helperIcon = R.drawable.ic_name_text_field_check,
helperColor = TerningMain,
isValid = true
isButtonValid = true
)
}
}

onValidationChanged(state.isValid)
onValidationChanged(state.isButtonValid)

TerningBasicTextField(
value = state.name,
onValueChange = onValueChange,
modifier = modifier,
textStyle = TerningTheme.typography.detail1,
textColor = Black,
textColor = if (value.isNotEmpty()) Black else Grey400,
drawLineColor = state.lineColor,
cursorBrush = SolidColor(Grey400),
hint = hint,
Expand Down
11 changes: 11 additions & 0 deletions core/src/main/java/com/terning/core/type/ProfileImage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,14 @@ enum class ProfileImage(
entries.indexOf(profileImage)
}
}

enum class SelectedProfileImage(
@DrawableRes val drawableResId: Int,
) {
BASIC(drawableResId = R.drawable.ic_terning_selected_profile_00),
LUCKY(drawableResId = R.drawable.ic_terning_selected_profile_01),
SMART(drawableResId = R.drawable.ic_terning_selected_profile_02),
GLASS(drawableResId = R.drawable.ic_terning_selected_profile_03),
CALENDAR(drawableResId = R.drawable.ic_terning_selected_profile_04),
PASSION(drawableResId = R.drawable.ic_terning_selected_profile_05);
}
68 changes: 68 additions & 0 deletions core/src/main/res/drawable/ic_terning_selected_profile_00.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="84dp"
android:height="84dp"
android:viewportWidth="84"
android:viewportHeight="84">
<path
android:pathData="M42,42m-38,0a38,38 0,1 1,76 0a38,38 0,1 1,-76 0"
android:fillColor="#BCBCBC"/>
<group>
<clip-path
android:pathData="M42,4L42,4A38,38 0,0 1,80 42L80,42A38,38 0,0 1,42 80L42,80A38,38 0,0 1,4 42L4,42A38,38 0,0 1,42 4z"/>
<path
android:pathData="M80,4H4V80H80V4Z"
android:fillColor="#FBF8CB"/>
<path
android:pathData="M61.95,81.966L71.64,53.542C72.314,51.472 71.574,49.192 69.807,47.909L45.971,30.59C44.204,29.308 41.819,29.308 40.053,30.59L16.217,47.909C14.45,49.192 13.719,51.462 14.384,53.542L23.494,81.567C24.169,83.638 26.097,85.045 28.282,85.045H57.751"
android:fillColor="#ffffff"/>
<path
android:pathData="M61.95,81.966L71.64,53.542C72.314,51.472 71.574,49.192 69.807,47.909L45.971,30.59C44.204,29.308 41.819,29.308 40.053,30.59L16.217,47.909C14.45,49.192 13.719,51.462 14.384,53.542L23.494,81.567C24.169,83.638 26.097,85.045 28.282,85.045H57.751"
android:strokeWidth="1.425"
android:fillColor="#00000000"
android:strokeColor="#171717"
android:strokeLineCap="round"/>
<path
android:pathData="M41.506,67.441H42.598C42.988,67.441 43.32,67.707 43.396,68.077L45.762,79.8C45.828,80.199 45.705,80.608 45.42,80.902L43.016,83.372C42.503,83.895 41.648,83.914 41.126,83.401L38.618,80.978C38.314,80.684 38.171,80.256 38.247,79.838L40.717,68.077C40.793,67.707 41.126,67.441 41.515,67.441H41.506Z"
android:strokeWidth="1.425"
android:fillColor="#40A56B"
android:strokeColor="#171717"/>
<path
android:pathData="M43.168,67.907H40.955C40.518,67.907 40.147,67.603 40.053,67.185L39.54,64.952C39.407,64.372 39.853,63.812 40.442,63.812H43.701C44.299,63.812 44.745,64.372 44.603,64.952L44.071,67.185C43.976,67.603 43.596,67.897 43.168,67.897V67.907Z"
android:strokeWidth="1.425"
android:fillColor="#40A56B"
android:strokeColor="#171717"/>
<path
android:pathData="M35.663,57.447C35.663,57.779 35.616,58.131 35.502,58.416C35.388,58.701 35.036,58.872 34.808,59.1C34.58,59.328 34.409,59.622 34.105,59.746C33.801,59.869 33.488,59.841 33.155,59.841C32.823,59.841 32.509,59.822 32.224,59.698C31.939,59.575 31.654,59.394 31.426,59.166C31.198,58.938 30.999,58.682 30.875,58.378C30.752,58.074 30.638,57.76 30.638,57.437C30.638,57.114 30.837,56.81 30.961,56.525C31.084,56.24 31.274,56.003 31.502,55.775C31.73,55.547 31.939,55.319 32.234,55.195C32.528,55.072 32.832,55.072 33.165,55.072C33.497,55.072 33.801,55.081 34.086,55.205C34.371,55.328 34.647,55.509 34.875,55.727C35.103,55.946 35.293,56.212 35.416,56.506C35.54,56.801 35.682,57.105 35.682,57.437L35.663,57.447Z"
android:fillColor="#F9DBDE"/>
<path
android:pathData="M35.663,57.447C35.663,57.779 35.616,58.131 35.502,58.416C35.388,58.701 35.036,58.872 34.808,59.1C34.58,59.328 34.409,59.622 34.105,59.746C33.801,59.869 33.488,59.841 33.155,59.841C32.823,59.841 32.509,59.822 32.224,59.698C31.939,59.575 31.654,59.394 31.426,59.166C31.198,58.938 30.999,58.682 30.875,58.378C30.752,58.074 30.638,57.76 30.638,57.437C30.638,57.114 30.837,56.81 30.961,56.525C31.084,56.24 31.274,56.003 31.502,55.775C31.73,55.547 31.939,55.319 32.234,55.195C32.528,55.072 32.832,55.072 33.165,55.072C33.497,55.072 33.801,55.081 34.086,55.205C34.371,55.328 34.647,55.509 34.875,55.727C35.103,55.946 35.293,56.212 35.416,56.506C35.54,56.801 35.682,57.105 35.682,57.437L35.663,57.447Z"
android:strokeWidth="0.7315"
android:fillColor="#00000000"
android:strokeColor="#F9DBDE"/>
<path
android:pathData="M53.343,57.266C53.343,57.599 53.267,57.931 53.143,58.226C53.02,58.52 52.839,58.824 52.611,59.043C52.383,59.261 52.079,59.432 51.785,59.556C51.49,59.679 51.167,59.651 50.835,59.651C50.502,59.651 50.217,59.584 49.923,59.461C49.628,59.337 49.267,59.28 49.049,59.052C48.83,58.824 48.669,58.511 48.545,58.216C48.422,57.922 48.422,57.599 48.422,57.266C48.422,56.934 48.45,56.611 48.564,56.326C48.678,56.041 48.897,55.775 49.125,55.556C49.353,55.338 49.638,55.214 49.932,55.091C50.227,54.967 50.502,54.92 50.835,54.92C51.167,54.92 51.49,54.863 51.785,54.986C52.079,55.11 52.355,55.3 52.583,55.528C52.811,55.756 53.01,56.022 53.134,56.326C53.257,56.63 53.343,56.943 53.343,57.276V57.266Z"
android:fillColor="#F9DBDE"/>
<path
android:pathData="M53.343,57.266C53.343,57.599 53.267,57.931 53.143,58.226C53.02,58.52 52.839,58.824 52.611,59.043C52.383,59.261 52.079,59.432 51.785,59.556C51.49,59.679 51.167,59.651 50.835,59.651C50.502,59.651 50.217,59.584 49.923,59.461C49.628,59.337 49.267,59.28 49.049,59.052C48.83,58.824 48.669,58.511 48.545,58.216C48.422,57.922 48.422,57.599 48.422,57.266C48.422,56.934 48.45,56.611 48.564,56.326C48.678,56.041 48.897,55.775 49.125,55.556C49.353,55.338 49.638,55.214 49.932,55.091C50.227,54.967 50.502,54.92 50.835,54.92C51.167,54.92 51.49,54.863 51.785,54.986C52.079,55.11 52.355,55.3 52.583,55.528C52.811,55.756 53.01,56.022 53.134,56.326C53.257,56.63 53.343,56.943 53.343,57.276V57.266Z"
android:strokeWidth="0.7315"
android:fillColor="#00000000"
android:strokeColor="#F9DBDE"/>
<path
android:pathData="M38.818,56.497C39.384,56.497 39.843,55.791 39.843,54.92C39.843,54.049 39.384,53.343 38.818,53.343C38.251,53.343 37.792,54.049 37.792,54.92C37.792,55.791 38.251,56.497 38.818,56.497Z"
android:fillColor="#171717"/>
<path
android:pathData="M45.182,56.497C45.749,56.497 46.208,55.791 46.208,54.92C46.208,54.049 45.749,53.343 45.182,53.343C44.616,53.343 44.157,54.049 44.157,54.92C44.157,55.791 44.616,56.497 45.182,56.497Z"
android:fillColor="#171717"/>
<path
android:pathData="M39.445,57.884C39.445,57.884 40.243,59.613 42.114,59.613C43.986,59.613 44.565,57.884 44.565,57.884"
android:strokeWidth="1.425"
android:fillColor="#00000000"
android:strokeColor="#171717"
android:strokeLineCap="round"/>
</group>
<path
android:pathData="M42,42m-41,0a41,41 0,1 1,82 0a41,41 0,1 1,-82 0"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#1EAC61"/>
</vector>
Loading

0 comments on commit 2635fb5

Please sign in to comment.