Skip to content
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

๐Ÿ”€ :: (#249) - ํ”„๋กœ๊ทธ๋žจ, ํ”„๋กœ๊ทธ๋žจ ์ฐธ๊ฐ€์ž ๊ด€๋ฆฌ ํŽ˜์ด์ง€์˜ UI ์š”์†Œ์ธ Box์™€ ๋ฆฌ์ŠคํŠธ ์•„์ดํ…œ์ด horizontalScroll์ด ๋  ์ˆ˜ ์žˆ๊ฒŒ ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค. #254

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
Expand All @@ -31,6 +32,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
Expand Down Expand Up @@ -156,11 +158,11 @@ internal fun HomeDetailProgramScreen(

Box(
modifier = Modifier
.fillMaxWidth()
.border(
width = 1.dp,
color = colors.gray200
)
.fillMaxWidth()
.padding(
horizontal = 16.dp,
vertical = 16.dp
Expand Down Expand Up @@ -238,7 +240,8 @@ internal fun HomeDetailProgramScreen(
is StandardProgramListUiState.Success -> {
StandardProgramList(
standardItem = standardProgramListUiState.data.toImmutableList(),
navigateToStandardProgramDetail = navigateToStandardProgramDetail
navigateToStandardProgramDetail = navigateToStandardProgramDetail,
horizontalScrollState = scrollState
)
}

Expand Down Expand Up @@ -294,7 +297,8 @@ internal fun HomeDetailProgramScreen(
is TrainingProgramListUiState.Success -> {
ProgramList(
trainingItem = trainingProgramUiState.data.toImmutableList(),
navigateToTrainingProgramDetail = navigateToTrainingProgramDetail
navigateToTrainingProgramDetail = navigateToTrainingProgramDetail,
horizontalScrollState = scrollState
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ internal fun HomeDetailStandardProgramParticipantScreen(
modifier = Modifier
.fillMaxWidth()
.padding(start = 16.dp)
.horizontalScroll(rememberScrollState())
.horizontalScroll(scrollState)
) {
Spacer(modifier = Modifier.width(20.dp))

Expand Down Expand Up @@ -270,7 +270,12 @@ internal fun HomeDetailStandardProgramParticipantScreen(
) {
when (standardProgramAttendListUiState) {
is StandardProgramAttendListUiState.Loading -> Unit
is StandardProgramAttendListUiState.Success -> HomeDetailStandardParticipantList(item = standardProgramAttendListUiState.data.toImmutableList())
is StandardProgramAttendListUiState.Success -> {
HomeDetailStandardParticipantList(
item = standardProgramAttendListUiState.data.toImmutableList(),
horizontalScrollState = scrollState
)
}
is StandardProgramAttendListUiState.Error -> {
Column(
verticalArrangement = Arrangement.spacedBy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ internal fun HomeDetailProgramParticipantScreen(
modifier = Modifier
.fillMaxWidth()
.padding(start = 16.dp)
.horizontalScroll(rememberScrollState())
.horizontalScroll(scrollState)
) {
Spacer(modifier = Modifier.width(20.dp))

Expand Down Expand Up @@ -272,7 +272,12 @@ internal fun HomeDetailProgramParticipantScreen(
) {
when (teacherTrainingProgramListUiState) {
is TeacherTrainingProgramListUiState.Loading -> Unit
is TeacherTrainingProgramListUiState.Success -> HomeDetailProgramParticipantList(item = teacherTrainingProgramListUiState.data.toImmutableList())
is TeacherTrainingProgramListUiState.Success -> {
HomeDetailProgramParticipantList(
item = teacherTrainingProgramListUiState.data.toImmutableList(),
horizontalScrollState = scrollState
)
}
is TeacherTrainingProgramListUiState.Error -> {
Column(
verticalArrangement = Arrangement.spacedBy(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.school_of_company.home.view.component

import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand All @@ -18,7 +19,8 @@ import kotlinx.collections.immutable.persistentListOf
@Composable
fun HomeDetailProgramParticipantList(
modifier: Modifier = Modifier,
item: ImmutableList<TeacherTrainingProgramResponseEntity> = persistentListOf()
item: ImmutableList<TeacherTrainingProgramResponseEntity> = persistentListOf(),
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, _ ->
LazyColumn(
Expand All @@ -30,7 +32,8 @@ fun HomeDetailProgramParticipantList(
itemsIndexed(item) { index, item ->
HomeDetailProgramParticipantListItem(
index = index + 1,
data = item
data = item,
horizontalScrollState = horizontalScrollState
)
}
}
Expand All @@ -40,7 +43,8 @@ fun HomeDetailProgramParticipantList(
@Composable
fun HomeDetailStandardParticipantList(
modifier: Modifier = Modifier,
item: ImmutableList<StandardAttendListResponseEntity> = persistentListOf()
item: ImmutableList<StandardAttendListResponseEntity> = persistentListOf(),
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, _ ->
LazyColumn(
Expand All @@ -52,7 +56,8 @@ fun HomeDetailStandardParticipantList(
itemsIndexed(item) { index, item ->
HomeDetailStandardProgramParticipantListItem(
index = index + 1,
data = item
data = item,
horizontalScrollState = horizontalScrollState
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun HomeDetailProgramParticipantListItem(
modifier: Modifier = Modifier,
index: Int,
data: TeacherTrainingProgramResponseEntity,
horizontalScrollState: ScrollState = rememberScrollState()
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, typography ->
Spacer(modifier = Modifier.height(20.dp))
Expand Down Expand Up @@ -105,6 +105,7 @@ private fun HomeDetailProgramParticipantListItemPreview() {
status = true,
entryTime = "2024-09-12 T 08:30",
leaveTime = "2024-09-12 T 08:30"
)
),
horizontalScrollState = rememberScrollState()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun HomeDetailStandardProgramParticipantListItem(
modifier: Modifier = Modifier,
index: Int,
data: StandardAttendListResponseEntity,
horizontalScrollState: ScrollState = rememberScrollState()
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, typography ->
Spacer(modifier = Modifier.height(20.dp))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.school_of_company.home.view.component

import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.rememberScrollState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -19,7 +21,8 @@ import kotlinx.collections.immutable.persistentListOf
fun ProgramList(
modifier: Modifier = Modifier,
trainingItem: ImmutableList<TrainingProgramListResponseEntity> = persistentListOf(),
navigateToTrainingProgramDetail: (Long) -> Unit
navigateToTrainingProgramDetail: (Long) -> Unit,
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, _ ->

Expand All @@ -33,7 +36,8 @@ fun ProgramList(
ProgramListItem(
index = index + 1,
data = item,
navigateToTrainingProgramDetail = navigateToTrainingProgramDetail
navigateToTrainingProgramDetail = navigateToTrainingProgramDetail,
horizontalScrollState = horizontalScrollState
)
}
}
Expand All @@ -44,7 +48,8 @@ fun ProgramList(
fun StandardProgramList(
modifier: Modifier = Modifier,
standardItem: ImmutableList<StandardProgramListResponseEntity> = persistentListOf(),
navigateToStandardProgramDetail: (Long) -> Unit
navigateToStandardProgramDetail: (Long) -> Unit,
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, _ ->

Expand All @@ -58,7 +63,8 @@ fun StandardProgramList(
StandardProgramListItem(
index = index + 1,
data = item,
navigateToStandardProgramDetail = navigateToStandardProgramDetail
navigateToStandardProgramDetail = navigateToStandardProgramDetail,
horizontalScrollState = horizontalScrollState
)
}
}
Expand All @@ -78,6 +84,7 @@ private fun ProgramListPreview() {
category = "ESSENTIAL"
)
),
navigateToTrainingProgramDetail = {}
navigateToTrainingProgramDetail = {},
horizontalScrollState = rememberScrollState()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun ProgramListItem(
index: Int,
data: TrainingProgramListResponseEntity,
navigateToTrainingProgramDetail: (Long) -> Unit,
horizontalScrollState: ScrollState = rememberScrollState()
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, typography ->

Expand Down Expand Up @@ -137,6 +137,7 @@ private fun ProgramListItemPreview() {
endedAt = "2024-09-12 T 08:30",
category = "ESSENTIAL"
),
navigateToTrainingProgramDetail = {}
navigateToTrainingProgramDetail = {},
horizontalScrollState = rememberScrollState()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fun StandardProgramListItem(
index: Int,
data: StandardProgramListResponseEntity,
navigateToStandardProgramDetail: (Long) -> Unit,
horizontalScrollState: ScrollState = rememberScrollState()
horizontalScrollState: ScrollState
) {
ExpoAndroidTheme { colors, typography ->

Expand Down Expand Up @@ -108,6 +108,7 @@ private fun StandardProgramListItemPreview() {
startedAt = "2024-09-12 T 08:30",
endedAt = "2024-09-12 T 08:30",
),
navigateToStandardProgramDetail = {}
navigateToStandardProgramDetail = {},
horizontalScrollState = rememberScrollState()
)
}
Loading