Skip to content

feat: 8주차 미션_레몬#56

Open
Lemon0610 wants to merge 4 commits into
mainfrom
lemon-8
Open

feat: 8주차 미션_레몬#56
Lemon0610 wants to merge 4 commits into
mainfrom
lemon-8

Conversation

@Lemon0610
Copy link
Copy Markdown
Collaborator

@Lemon0610 Lemon0610 commented May 20, 2026

📌 PR 제목

🔗 관련 이슈

Closes #55

✨ 변경 사항

  • 3주차 미션(RecyclerView)을 Compose의 LazyColumn으로 Migration
  • items() 함수를 사용하여 동일한 리스트 데이터 표시
  • 아이템 레이아웃을 Composable 함수로 새로 작성
  • 각 아이템에 고유한 key를 지정하여 상태 안정성 확보

🔍 테스트

  • 테스트 완료
  • 에러 없음

📸 스크린샷 (선택)

구매하기 위시리스트
화면 캡처 2026-05-20 102121 화면 캡처 2026-05-20 102152 화면 캡처 2026-05-20 102214

🚨 추가 이슈

@Lemon0610 Lemon0610 changed the title Lemon 8 feat: 8주차 미션_레몬 May 20, 2026
@Lemon0610 Lemon0610 self-assigned this May 20, 2026
Comment on lines +18 to +23
@Composable
fun ProductGridItem(
product: ProductData,
showWishButton: Boolean = true,
onWishClick: () -> Unit = {}
) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compose 구조 좋아용

Copy link
Copy Markdown
Collaborator

@jeongkyueun jeongkyueun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LazyVerticalGrid로 마이그레이션하면서 기존 Adapter 구조보다 훨씬 코드가 직관적이고 깔끔해진 것 같습니다! 잘 구현하셨고 고생 많으셨습니다!

Copy link
Copy Markdown
Collaborator

@kimdoyeon1234 kimdoyeon1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중첩 네비게이션(BuyGraph)까지 구현하신 점, ViewModel에서 상태를 안전하게 관리하신 점, SharedPreferences로 위시리스트를 영속적으로 저장하신 점 모두 훌륭합니다!

다만 HomeScreen에서 verticalScroll이 붙은 Column 안에 LazyRow를 중첩하고 계신데, LazyRow의 높이 측정이 제대로 되지 않아 레이아웃이 깨질 수 있습니다! LazyColumn으로 변경하고 item { } / items { } DSL로 구성해주세요!

그리고 selectedTabIndex 상태가 MainScreen에서 관리되고 있는데, 탭 상태는 BuyScreen 내부나 ViewModel에서 관리하는 게 더 적절합니다!

바텀 네비게이션 라벨도 하드코딩된 문자열 대신 strings.xml로 분리해주시면 좋겠습니다!

전반적으로 완성도가 매우 높고 챌린저 미션 그 이상을 구현하셨습니다! 수고하셨습니다

Comment on lines +28 to +87
fun HomeScreen(viewModel: MainViewModel) {
val products = viewModel.productList
val scrollState = rememberScrollState()

Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
.verticalScroll(scrollState)
) {
Text(
text = stringResource(id = R.string.Title),
fontSize = 40.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(top = 24.dp, start = 20.dp)
)
Text(
text = stringResource(id = R.string.date),
fontSize = 20.sp,
modifier = Modifier.padding(start = 20.dp, bottom = 30.dp)
)
Image(
painter = painterResource(id = R.drawable.img_home),
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
.align(Alignment.CenterHorizontally),
contentScale = ContentScale.Crop
)

Text(
text = stringResource(id = R.string.newEn),
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(start = 20.dp, top = 20.dp)
)
Text(
text = stringResource(id = R.string.newKr),
fontSize = 24.sp,
modifier = Modifier.padding(start = 20.dp, bottom = 12.dp)
)

LazyRow(
modifier = Modifier.fillMaxWidth(),
contentPadding = PaddingValues(horizontal = 16.dp),
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
items(
items = products,
key = { item -> item.id },
contentType = { "ProductHorizontalItem" }
) { product ->
HorizontalProductItem(
product = product,
onWishClick = { viewModel.toggleWishStatus(product.id) }
)
}
}
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스크롤 방향이 달라서 크래시는 발생하지 않지만, verticalScroll이 붙은 Column 안에 Lazy 계열 컴포저블을 중첩하면 LazyRow의 높이를 측정할 수 없어서 레이아웃이 깨질 수 있습니다! Column 대신 LazyColumn으로 바꾸고 item { } / items { } DSL로 모든 콘텐츠를 구성하는 걸 추천드립니다!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 selectedTabIndex를 MainScreen에서 remember로 관리하고 계신데, 탭 상태는 BuyScreen에 속하는 UI 상태이므로 BuyScreen 내부나 ViewModel에서 관리하는 게 더 적절합니다! MainScreen이 탭 상태까지 알고 있을 필요가 없습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] 8주차 미션_레몬

4 participants