Skip to content

Commit

Permalink
Merge pull request #198 from YAPP-Github/feature/issue-197-manage-loa…
Browse files Browse the repository at this point in the history
…ding-shimmer

[ISSUE-197] 약속 관리 로딩 시 쉬머 애니메이션 추가
  • Loading branch information
jihee-dev authored Aug 3, 2022
2 parents 12c2732 + 28f5343 commit e116175
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.yapp.growth.presentation.ui.main.manage
import androidx.annotation.StringRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
Expand All @@ -29,13 +30,13 @@ import com.google.accompanist.pager.ExperimentalPagerApi
import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.PagerState
import com.google.accompanist.pager.rememberPagerState
import com.valentinilk.shimmer.shimmer
import com.yapp.growth.base.LoadState
import com.yapp.growth.domain.entity.Category
import com.yapp.growth.domain.entity.Plan
import com.yapp.growth.presentation.R
import com.yapp.growth.presentation.component.PlanzCreateAppBar
import com.yapp.growth.presentation.component.PlanzError
import com.yapp.growth.presentation.component.PlanzLoading
import com.yapp.growth.presentation.theme.*
import com.yapp.growth.presentation.ui.main.MainContract
import com.yapp.growth.presentation.ui.main.MainViewModel
Expand Down Expand Up @@ -234,7 +235,7 @@ fun ManagePagerContent(
onCreateButtonClick: () -> Unit,
) {
when (loadState) {
LoadState.LOADING -> PlanzLoading()
LoadState.LOADING -> ManageShimmerLoading()
LoadState.SUCCESS -> {
if (plans.isNotEmpty()) {
ManagePlansList(plans = plans, type = type, onItemClick = onItemClick)
Expand All @@ -244,6 +245,29 @@ fun ManagePagerContent(
}
}

@Composable
fun ManageShimmerLoading() {
Column(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 20.dp)
.shimmer(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
Spacer(modifier = Modifier.height(24.dp))

repeat(2) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(72.dp)
.clip(RoundedCornerShape(12.dp))
.background(Gray200)
)
}
}
}

@Composable
fun ManagePlansList(
plans: List<Plan>,
Expand Down

0 comments on commit e116175

Please sign in to comment.