-
Notifications
You must be signed in to change notification settings - Fork 1
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
✨ 전체 뱃지 페이지 UI 구현 #86
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.whyranoid.domain.model.challenge | ||
|
||
import androidx.annotation.DrawableRes | ||
|
||
data class BadgeInfo ( | ||
val id: Int, | ||
@DrawableRes val image: Int, | ||
val name: String, | ||
val receivedAt: String = "" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.whyranoid.presentation.component.button | ||
|
||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.Button | ||
import androidx.compose.material.ButtonDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.whyranoid.presentation.theme.WalkieTheme | ||
|
||
@Composable | ||
fun WalkieNormalButton( | ||
buttonText: String, | ||
onButtonClick: () -> Unit, | ||
) { | ||
Button( | ||
onClick = { | ||
onButtonClick() | ||
}, | ||
colors = ButtonDefaults.buttonColors( | ||
contentColor = Color.Black, | ||
disabledContentColor = Color.Black, | ||
backgroundColor = Color(0xFFEEEEEE) | ||
), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.height(34.dp), | ||
shape = RoundedCornerShape(7.dp), | ||
elevation = null | ||
) { | ||
Text( | ||
text = buttonText, | ||
style = TextStyle( | ||
color = Color.Black, | ||
fontSize = 14.sp | ||
) | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun WalkieNormalButtonPreview() { | ||
WalkieTheme { | ||
WalkieNormalButton("전체 뱃지 보기") {} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.whyranoid.presentation.reusable | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.heightIn | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.widthIn | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.whyranoid.domain.model.challenge.BadgeInfo | ||
import com.whyranoid.presentation.R | ||
import com.whyranoid.presentation.theme.WalkieTheme | ||
import com.whyranoid.presentation.theme.WalkieTypography | ||
|
||
@Composable | ||
fun BadgeItem( | ||
badgeInfo: BadgeInfo | ||
) { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.size(54.dp) | ||
.align(Alignment.CenterHorizontally) | ||
) { | ||
Image( | ||
painter = painterResource(badgeInfo.image), | ||
contentDescription = null | ||
) | ||
} | ||
|
||
Spacer( | ||
modifier = Modifier.height(4.dp) | ||
) | ||
|
||
Text( | ||
text = badgeInfo.name, | ||
textAlign = TextAlign.Center, | ||
maxLines = 2, | ||
overflow = TextOverflow.Ellipsis, | ||
style = WalkieTypography.Body2, | ||
modifier = Modifier | ||
.widthIn(max = 62.dp) | ||
.heightIn(max = 24.dp) | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun BadgePreview() { | ||
WalkieTheme { | ||
BadgeItem( | ||
BadgeInfo( | ||
1, | ||
R.drawable.badge_test_2, | ||
"test" | ||
) | ||
) | ||
} | ||
} | ||
Comment on lines
+60
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 프리뷰를 만들어야 하는 이유를 물어보면 승민님은 뭐라고 대답하실 것 같으세요??
근데 최근에 조금 규모가 큰 협업을 하면서 느꼈던게, 프리뷰가 없으니까 남이 만든 컴포저블을 나중에 확인하기가 너무 힘들어서, 프리뷰를 만들어야겠다고 생각했어요. 승민님은 혹시 다른 이유가 있으신가요? 아니면 비슷한 이유? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 말씀하신 것처럼 협업을 위한 용도 + 다양한 엣지 케이스나 글자 크기 테스트가 필요한 경우에 씁니다. 보통 디자인 가이드는 글자 크기와 1줄인 것, 여러 줄인 것 모두 같이 나오니까 빌드마다 바꿔서 실행하기 힘드니까요. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 혹시 버튼이 따로 컴포저블로 없었나요??!!
아니면 확장성이 좀 구려서 다시 만드셨남?..
(진짜 몰라서 물어봄..!)
감사해용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 확인했을 때는 없었던거 같아서 만들었어요. 당시 기억이 잘 안나네요 ㅎㅎ