Skip to content

Commit

Permalink
Merge pull request #248 from mash-up-kr/feat/home_update
Browse files Browse the repository at this point in the history
[Feat] 홈 변경사항 반영
  • Loading branch information
EvergreenTree97 authored Sep 26, 2024
2 parents e093cd5 + 3be9788 commit 0213e0a
Show file tree
Hide file tree
Showing 7 changed files with 230 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,14 @@ object FarmemeIcon {
contentDescription = null,
tint = Color.Unspecified
)

@Composable
fun Upload(
modifier: Modifier = Modifier,
)= Icon(
modifier = modifier,
painter = painterResource(R.drawable.ic_upload_16),
contentDescription = null,
tint = Color.Unspecified
)
}
18 changes: 18 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_upload_16.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="17dp"
android:viewportWidth="16"
android:viewportHeight="17">
<path
android:pathData="M4.4,2.1L11.067,2.1A2,2 0,0 1,13.067 4.1L13.067,12.9A2,2 0,0 1,11.067 14.9L4.4,14.9A2,2 0,0 1,2.4 12.9L2.4,4.1A2,2 0,0 1,4.4 2.1z"
android:strokeWidth="1.59994"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M7.833,10.5V6.5M7.833,6.5L5.833,7.833M7.833,6.5L9.833,7.833"
android:strokeWidth="1.59994"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
</vector>
158 changes: 81 additions & 77 deletions core/designsystem/src/main/res/drawable/logo_farmeme.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/designsystem/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="recommendation_title">추천</string>
<string name="recommendation_title">둘러보기</string>
<string name="search_title">검색</string>
<string name="mypage_title">마이</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import team.ppac.domain.model.Meme
import team.ppac.recommendation.component.ActionButtons
import team.ppac.recommendation.component.HeroModulePager
import team.ppac.recommendation.component.KeywordsRow
import team.ppac.recommendation.component.SeenMemeProgressBar
import team.ppac.recommendation.component.UploadButton
import team.ppac.recommendation.mvi.RecommendationIntent
import team.ppac.recommendation.mvi.RecommendationState
import kotlin.math.roundToInt
Expand Down Expand Up @@ -122,51 +122,40 @@ internal fun RecommendationScreen(
painterResource(id = R.drawable.logo_farmeme),
contentDescription = null,
)
Spacer(modifier = Modifier.padding(top = 10.dp))
Spacer(modifier = Modifier.padding(top = 12.dp))
Text(
text = "이번 주 이 밈 어때!",
text = "NEW! 따끈따끈한 밈",
style = FarmemeTheme.typography.heading.large.bold,
color = FarmemeTheme.textColor.primary,
)
Spacer(modifier = Modifier.padding(top = 16.dp))
Spacer(modifier = Modifier.padding(top = 4.dp))
Text(
text = "최근에 사람들이 올린 밈 구경하세요.",
style = FarmemeTheme.typography.body.medium.medium,
color = FarmemeTheme.textColor.secondary,
)
Spacer(modifier = Modifier.padding(top = 20.dp))
if (state.isLoading) {
Spacer(modifier = Modifier.padding(top = 20.dp))
Box(
modifier = Modifier
.clip(RoundedCornerShape(4.dp))
.clip(RoundedCornerShape(10.dp))
.showSkeleton(
isLoading = state.isLoading,
viewType = SkeletonViewType.Home
)
.size(
width = 200.dp,
height = 16.dp,
width = 130.dp,
height = 36.dp,
)
)
} else {
SeenMemeProgressBar(
seenMemeCount = state.seenMemeCount,
)
Spacer(modifier = Modifier.padding(top = 8.dp))
Text(
text = when {
state.seenMemeCount == 5 -> {
"완밈! 다음 주 밈도 기대해 주세요"
}
UploadButton(
onClick = {

state.level >= 2 -> {
"추천 밈 둘러보세요!"
}

else -> {
"밈 보고 레벨 포인트 받아요!"
}
},
style = FarmemeTheme.typography.body.medium.medium,
color = FarmemeTheme.textColor.secondary,
}
)
}
Spacer(modifier = Modifier.padding(top = 32.dp))
Spacer(modifier = Modifier.padding(top = 28.dp))
when {
state.thisWeekMemes.isNotEmpty() -> {
HeroModulePager(
Expand All @@ -175,7 +164,13 @@ internal fun RecommendationScreen(
onMovePage = onScrollPager,
onLoadMeme = onLoadMeme
)
Spacer(modifier = Modifier.padding(top = 20.dp))
Spacer(modifier = Modifier.padding(top = 16.dp))
Text(
text= state.thisWeekMemes[heroModulePagerState.currentPage].title,
style = FarmemeTheme.typography.heading.small.medium,
color = FarmemeTheme.textColor.primary,
)
Spacer(modifier = Modifier.padding(top = 4.dp))
KeywordsRow(
modifier = Modifier
.fillMaxWidth()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ fun HeroModulePager(
BlurEffect(
lerp(
start = 1f,
stop = 270f / 10f, // 270 / 10
stop = 280f / 10f,
fraction = pageOffset.absoluteValue.coerceIn(0f, 1f),
), lerp(
start = 1f,
stop = 310f / 10f, // 310 / 10
stop = 280f / 10f,
fraction = pageOffset.absoluteValue.coerceIn(0f, 1f),
)
)
Expand All @@ -115,7 +115,7 @@ fun HeroModulePager(
this
}
}
.height(310.dp))
.height(280.dp))
{
AsyncImage(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package team.ppac.recommendation.component

import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.drawscope.rotate
import androidx.compose.ui.unit.dp
import team.ppac.designsystem.FarmemeTheme
import team.ppac.designsystem.foundation.FarmemeIcon
import team.ppac.designsystem.foundation.FarmemeRadius
import team.ppac.designsystem.util.extension.noRippleClickable

@Composable
internal fun UploadButton(
modifier: Modifier = Modifier,
onClick: () -> Unit,
) {
val transition = rememberInfiniteTransition(label = "transition")
val angle by transition.animateFloat(
initialValue = 0f,
targetValue = 360f,
animationSpec = infiniteRepeatable(
animation = tween(1000, easing = LinearEasing),
repeatMode = RepeatMode.Restart,
),
label = "angle animation"
)
val brush = Brush.sweepGradient(
colors = buildList {
add(FarmemeTheme.backgroundColor.brand)
add(FarmemeTheme.backgroundColor.primary)
}
)
Box(
modifier = modifier
.clip(FarmemeRadius.Radius10.shape)
.noRippleClickable(onClick = onClick),
contentAlignment = Alignment.Center
) {
Box(
modifier = Modifier
.clip(FarmemeRadius.Radius10.shape)
.padding(1.5.dp)
.drawWithContent {
rotate(angle) {
drawCircle(
brush = brush,
radius = size.width,
)
}
drawContent()
},
) {
Row(
modifier = Modifier
.height(36.dp)
.clip(FarmemeRadius.Radius10.shape)
.background(color = FarmemeTheme.backgroundColor.primary)
.padding(horizontal = 15.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
FarmemeIcon.Upload()
Spacer(Modifier.width(4.dp))
Text(
text = "나도 밈 올리기",
style = FarmemeTheme.typography.body.medium.semibold,
color = FarmemeTheme.textColor.inverse,
)
}
}
}

}

0 comments on commit 0213e0a

Please sign in to comment.