-
Notifications
You must be signed in to change notification settings - Fork 3
[UI] 데이터 없는 페이지들 구현 #56
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
Changes from all commits
77a4fb2
716d881
617aaa5
605b0fd
35c34c0
2c3cab7
6028814
afdad73
2acba93
6d415c8
6573df6
9503ef8
6ae3496
3e3ab2d
5015b9e
a3c8b7c
12c0412
a3cca1b
308ac20
6791bbd
b108b3f
e9267f0
a68ceaf
d9f7223
14bb55e
d4107eb
29c3ed7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,30 +27,32 @@ fun MenuBottomSheet( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CustomBottomSheet( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onDismiss = onDismiss, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| items.forEachIndexed { index, item -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (index > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Spacer(modifier = Modifier.height(8.dp)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HorizontalDivider(modifier = Modifier.height(1.dp), color = colors.Grey03) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Spacer(modifier = Modifier.height(8.dp)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Column(modifier = Modifier.padding(20.dp)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| items.forEachIndexed { index, item -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (index > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Spacer(modifier = Modifier.height(8.dp)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HorizontalDivider(modifier = Modifier.height(1.dp), color = colors.Grey03) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Spacer(modifier = Modifier.height(8.dp)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Column( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .height(50.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .padding(horizontal = 12.dp, vertical = 8.dp), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| verticalArrangement = Arrangement.Center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Text( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text = item.text, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style = typography.menu_m500_s16_h24, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color = item.color, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Column( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillMaxWidth() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .clickable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| item.onClick() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onDismiss() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .height(50.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .padding(horizontal = 12.dp, vertical = 8.dp), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| verticalArrangement = Arrangement.Center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Text( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text = item.text, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style = typography.menu_m500_s16_h24, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color = item.color, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillMaxWidth() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .clickable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| item.onClick() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onDismiss() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+30
to
57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 레이아웃 구조 개선되었으나 접근성 고려 필요 레이아웃 구조가 개선되고 적절한 패딩이 추가되었습니다. 하지만 클릭 가능한 영역이 전체 아이템에서 텍스트로만 제한된 점이 우려됩니다. 접근성을 위해 클릭 영역을 전체 아이템으로 확장하는 것을 권장합니다: Column(
modifier = Modifier
.height(50.dp)
- .padding(horizontal = 12.dp, vertical = 8.dp),
+ .padding(horizontal = 12.dp, vertical = 8.dp)
+ .clickable {
+ item.onClick()
+ onDismiss()
+ },
verticalArrangement = Arrangement.Center
) {
Text(
text = item.text,
style = typography.menu_m500_s16_h24,
color = item.color,
- modifier = Modifier
- .fillMaxWidth()
- .clickable {
- item.onClick()
- onDismiss()
- }
+ modifier = Modifier.fillMaxWidth()
)
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,13 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package com.texthip.thip.ui.common.cards | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.background | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.clickable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.Arrangement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.Box | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.Column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.Row | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.fillMaxWidth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.height | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.padding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.layout.size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.pager.HorizontalPager | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -14,9 +16,7 @@ import androidx.compose.foundation.shape.CircleShape | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.material3.Text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.runtime.Composable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.runtime.mutableStateMapOf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.runtime.remember | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.runtime.toMutableStateList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.ui.Alignment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.ui.Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.ui.res.stringResource | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.compose.ui.tooling.preview.Preview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -30,17 +30,12 @@ import com.texthip.thip.ui.theme.ThipTheme.typography | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun CardVote( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voteData: List<VoteData> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voteData: List<VoteData>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onVoteClick: (VoteData) -> Unit = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val pageCount = voteData.size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val pagerState = rememberPagerState(pageCount = { pageCount }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 각 페이지별 상태 기억: 선택 인덱스, 선택 여부 포함한 voteItems | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val selectedIndexes = remember { mutableStateMapOf<Int, Int?>() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val voteItemStates = remember { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voteData.map { it.voteItems.toMutableStateList() }.toMutableStateList() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Column( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillMaxWidth() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -55,52 +50,65 @@ fun CardVote( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier.padding(horizontal = 12.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HorizontalPager( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state = pagerState, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier.fillMaxWidth() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { page -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val voteItems = voteItemStates[page] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val selectedIndex = selectedIndexes[page] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val hasVoted = voteItems.any { it.isVoted } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Column( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier.padding(horizontal = 12.dp), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| verticalArrangement = Arrangement.spacedBy(10.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (voteData.isEmpty()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Box( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillMaxWidth() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .padding(top = 12.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .padding(vertical = 60.dp), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contentAlignment = Alignment.Center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Text( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text = voteData[page].description, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text = stringResource(R.string.no_vote), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style = typography.info_m500_s12, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color = colors.White, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GroupVoteButton( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voteItems = voteItems, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selectedIndex = selectedIndex, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hasVoted = hasVoted, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onOptionSelected = { index -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selectedIndexes[page] = if (selectedIndex == index) null else index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voteItemStates[page] = voteItems.mapIndexed { i, item -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| item.copy(isVoted = i == index && selectedIndex != index) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }.toMutableStateList() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color = colors.Grey | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HorizontalPager( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state = pagerState, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier.fillMaxWidth() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { page -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val vote = voteData[page] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val voteItems = vote.voteItems.take(3) // 최대 3개만 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Row( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillMaxWidth(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| horizontalArrangement = Arrangement.Center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repeat(pageCount) { iteration -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val color = if (pagerState.currentPage == iteration) colors.White else colors.Grey02 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Box( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Column( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .height(176.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .padding(horizontal = 12.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .background(color, CircleShape) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .size(4.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .clickable { onVoteClick(vote) }, // 전체 클릭 시 이동 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| verticalArrangement = Arrangement.spacedBy(10.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Text( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text = vote.description, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style = typography.info_m500_s12, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color = colors.White, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GroupVoteButton( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| voteItems = voteItems, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selectedIndex = null, // 표시용이므로 선택 없음 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hasVoted = false, // 투표 상태 없음 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onOptionSelected = { onVoteClick(vote) } // 어떤 항목을 눌러도 이동 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Row( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillMaxWidth(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| horizontalArrangement = Arrangement.Center | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repeat(pageCount) { iteration -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val color = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (pagerState.currentPage == iteration) colors.White else colors.Grey02 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Box( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .padding(horizontal = 12.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .background(color, CircleShape) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .size(4.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+97
to
112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 빈 데이터 상태에서도 페이지 인디케이터 표시됨 데이터가 비어있을 때도 페이지 인디케이터 점들이 표시되는데, 이는 사용자에게 혼란을 줄 수 있습니다. 빈 상태에서는 인디케이터를 숨기는 것이 좋겠습니다. - Row(
- Modifier
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.Center
- ) {
- repeat(pageCount) { iteration ->
- val color =
- if (pagerState.currentPage == iteration) colors.White else colors.Grey02
- Box(
- modifier = Modifier
- .padding(horizontal = 12.dp)
- .background(color, CircleShape)
- .size(4.dp)
- )
+ if (pageCount > 1) {
+ Row(
+ Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.Center
+ ) {
+ repeat(pageCount) { iteration ->
+ val color =
+ if (pagerState.currentPage == iteration) colors.White else colors.Grey02
+ Box(
+ modifier = Modifier
+ .padding(horizontal = 12.dp)
+ .background(color, CircleShape)
+ .size(4.dp)
+ )
+ }
}
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -109,5 +117,13 @@ fun CardVote( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Preview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private fun CardVotePreview() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CardVote(voteData = mockVoteData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Column( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| modifier = Modifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillMaxWidth() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .padding(16.dp), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| verticalArrangement = Arrangement.spacedBy(16.dp) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CardVote(voteData = mockVoteData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CardVote(voteData = emptyList()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기는 Column으로 감싸고 패딩 추가하신 이유가 무엇인가용? 디자인상으로 기존 컴포넌트가 문제될 것이 없어보이는데 어떤 이유로 수정하시게 된건지 궁금합니닷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 개인적인 QA 진행하면서 피그마랑 디자인이 다르길래 수정한건데
아마 규빈이가 이 bottomsheet도 같이 써야해서 공통으로 분리하면서 padding이 사라져서 추가한걸거입니둣 ~