Skip to content

Commit

Permalink
[TNT-110] refactor: derivedStateOf 도입 및 컴포저블 사이 공백 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
SeonJeongk committed Jan 16, 2025
1 parent 8598c1b commit 4535114
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand All @@ -46,9 +47,7 @@ fun SetTrainerProfileScreen(
// TODO 상태 관리 따로 빼기
val maxLength = 15
var text by remember { mutableStateOf("") }
var warningState by remember { mutableStateOf(false) }

warningState = text.length > maxLength
val warningState by remember { derivedStateOf { text.length > maxLength } }

Box(
modifier = modifier
Expand All @@ -64,20 +63,15 @@ fun SetTrainerProfileScreen(
) {
// TODO 버튼 클릭 시 트레이너/트레이니 화면으로 이동
TnTTopBar(onBackClick = {})

Text(
text = stringResource(R.string.signup_set_name_title),
modifier = Modifier.padding(start = 24.dp),
color = TnTTheme.colors.neutralColors.Neutral950,
style = TnTTheme.typography.h2,
)

Spacer(Modifier.padding(top = 48.dp))

SetProfileImage()

Spacer(Modifier.padding(top = 60.dp))

TnTLabeledTextField(
title = stringResource(R.string.name),
value = text,
Expand All @@ -96,11 +90,10 @@ fun SetTrainerProfileScreen(
warningMessage = "$maxLength" + stringResource(R.string.signup_warning_text_length),
)
}

// TODO 트레이너 프로필 생성 완료 화면으로 이동
TnTBottomButton(
text = stringResource(R.string.next),
enabled = text.isNotEmpty() && !warningState,
enabled = text.isNotBlank() && !warningState,
onClick = { },
modifier = Modifier
.align(Alignment.BottomCenter)
Expand Down Expand Up @@ -136,7 +129,6 @@ private fun SetProfileImage(
.size(131.dp)
.clip(CircleShape),
)

// TODO 버튼 클릭 시 권한 확인 후 사진 선택
IconButton(
onClick = {},
Expand Down

0 comments on commit 4535114

Please sign in to comment.