Skip to content

Commit

Permalink
#11 [feat] : 홈 화면 멀티 리사이클러뷰 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
chanubc committed Apr 19, 2024
1 parent abf8e1e commit 3cfb005
Showing 1 changed file with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
package com.sopt.now.compose.feature.home

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.sopt.now.compose.R
import com.sopt.now.compose.component.row.BirthRow
import com.sopt.now.compose.component.row.FriendRowOnCard
import com.sopt.now.compose.component.row.ProfileRow
import com.sopt.now.compose.component.text.TitleWithDivider
import com.sopt.now.compose.ui.theme.NOWSOPTAndroidTheme

@Composable
fun HomeScreen() {
val viewModel: HomeViewModel = viewModel()
Scaffold(
modifier = Modifier.padding(horizontal = 16.dp)
) { paddingValues ->
LazyColumn(
modifier = Modifier.padding(paddingValues),
modifier = Modifier
.padding(paddingValues)
.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
val mockList = viewModel.mockBirthList

item {
Spacer(modifier = Modifier.padding(top = 16.dp))
ProfileRow(data = viewModel.mockProfileList)
TitleWithDivider(title = stringResource(R.string.home_birth_friend))
}

items(viewModel.filterAndSortBirthList(mockList)) { item ->
BirthRow(data = item)
}
item {
TitleWithDivider(title = stringResource(R.string.home_firends))
}
itemsIndexed(mockList) { index, item ->
FriendRowOnCard(data = item)
if (index == mockList.lastIndex) Spacer(modifier = Modifier.height(16.dp))
}
}
}
}
Expand Down

0 comments on commit 3cfb005

Please sign in to comment.