Skip to content

Commit

Permalink
[chore] #4 코드리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
HAJIEUN02 committed Oct 31, 2024
1 parent 34eb143 commit 34bdb6a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sopt.and.presentation.ui.home

import okhttp3.internal.immutableListOf
import org.sopt.and.presentation.util.UiEffect
import org.sopt.and.presentation.util.UiEvent
import org.sopt.and.presentation.util.UiState
Expand All @@ -10,15 +11,15 @@ class HomeContract {
}

enum class HomeStatus {
Idle, Success, Fail
Loading, Success, Fail
}

data class HomeState(
val bannerImgList: List<String> = listOf(),
val bannerImgList: List<String> = immutableListOf(),
val currentBannerPage: Int = 0,
val editorRecommendedList: List<String> = listOf(),
val todayTopRankingList: List<String> = listOf(),
val homeStatus: HomeStatus = HomeStatus.Idle
val editorRecommendedList: List<String> = immutableListOf(),
val todayTopRankingList: List<String> = immutableListOf(),
val homeStatus: HomeStatus = HomeStatus.Loading
) : UiState

sealed class HomeSideEffect : UiEffect {
Expand Down
32 changes: 13 additions & 19 deletions app/src/main/java/org/sopt/and/presentation/ui/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -155,21 +154,18 @@ fun HomeBannerItemCountText(
currentPage: String,
pageCount: String
) {
Row(
modifier = Modifier
Text(
text = stringResource(
id = R.string.home_banner_page_count,
currentPage,
pageCount
),
modifier = modifier
.clip(RoundedCornerShape(15.dp))
.background(Gray100)
.padding(horizontal = 8.dp, vertical = 4.dp)
) {
Text(
text = stringResource(
id = R.string.home_banner_page_count,
currentPage,
pageCount
),
fontSize = 10.sp
)
}
.padding(horizontal = 8.dp, vertical = 4.dp),
fontSize = 10.sp
)
}

@Composable
Expand Down Expand Up @@ -226,14 +222,12 @@ fun TodayTopRankingImgList(
@Composable
fun HomePreview() {
ANDANDROIDTheme {
val homeViewModel = HomeViewModel()

HomeScreen(
bannerImgList = homeViewModel.mockBannerItem,
bannerImgList = listOf(""),
numPages = "6",
onCurrentPageChanged = { },
editorRecommendedImgList = homeViewModel.mockEditorRecommendedItem,
todayTopRankingImgList = homeViewModel.mockTodayTopRankingItem
editorRecommendedImgList = listOf(""),
todayTopRankingImgList = listOf("")
)
}
}
8 changes: 3 additions & 5 deletions app/src/main/java/org/sopt/and/presentation/ui/my/MyScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.sopt.and.presentation.ui.my

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -41,16 +42,13 @@ fun MyScreen(
modifier = Modifier
.fillMaxWidth()
.background(Gray300)
.padding(horizontal = 15.dp, vertical = 20.dp)
.padding(horizontal = 15.dp, vertical = 20.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
MyProfile(userEmail = userName)

Spacer(modifier = Modifier.height(8.dp))

MyPurchaseBox(information = stringResource(R.string.my_purchase_event))

Spacer(modifier = Modifier.height(8.dp))

MyPurchaseBox(information = stringResource(R.string.my_purchase_ticket))
}

Expand Down

0 comments on commit 34bdb6a

Please sign in to comment.