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

[ISSUE-197] 약속 관리 로딩 시 쉬머 애니메이션 추가 #198

Merged
merged 2 commits into from
Aug 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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