-
Notifications
You must be signed in to change notification settings - Fork 6
[MOB1-1742] 배너 스펙 확장 - left, right icon을 구분하여 설정할 수 있돌고 수정 #106
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
base: exp
Are you sure you want to change the base?
Changes from 2 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 |
|---|---|---|
|
|
@@ -39,6 +39,10 @@ import androidx.compose.ui.unit.sp | |
| import io.channel.bezier.BezierTheme | ||
| import io.channel.bezier.compose.R | ||
|
|
||
| @Deprecated( | ||
| message = "Use leftIcon and leftIconColor parameters instead", | ||
| replaceWith = ReplaceWith("Banner(type = type, description = description, modifier = modifier, title = title, leftIcon = icon, leftIconColor = iconColor, onClick = onClick, onRemove = onRemove, content = content)"), | ||
| ) | ||
| @Composable | ||
| fun Banner( | ||
| type: BannerType, | ||
|
|
@@ -62,14 +66,19 @@ fun Banner( | |
| }, | ||
| modifier = modifier, | ||
| title = title, | ||
| icon = icon, | ||
| iconColor = iconColor, | ||
| leftIcon = icon, | ||
| leftIconColor = iconColor, | ||
| rightIcon = null, | ||
| onClick = onClick, | ||
| onRemove = onRemove, | ||
| content = content, | ||
| ) | ||
| } | ||
|
|
||
| @Deprecated( | ||
| message = "Use leftIcon and leftIconColor parameters instead", | ||
| replaceWith = ReplaceWith("Banner(type = type, description = description, modifier = modifier, title = title, leftIcon = icon, leftIconColor = iconColor, onClick = onClick, onRemove = onRemove, content = content)"), | ||
| ) | ||
| @Composable | ||
| fun Banner( | ||
| type: BannerType, | ||
|
|
@@ -93,8 +102,75 @@ fun Banner( | |
| }, | ||
| modifier = modifier, | ||
| title = title, | ||
| icon = icon, | ||
| iconColor = iconColor, | ||
| leftIcon = icon, | ||
| leftIconColor = iconColor, | ||
| rightIcon = null, | ||
| onClick = onClick, | ||
| onRemove = onRemove, | ||
| content = content, | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| fun Banner( | ||
| type: BannerType, | ||
| description: AnnotatedString, | ||
| modifier: Modifier = Modifier, | ||
| title: String? = null, | ||
| leftIcon: Painter? = null, | ||
| leftIconColor: Color = Color.Unspecified, | ||
| rightIcon: Painter? = null, | ||
| onClick: (() -> Unit)? = null, | ||
| onRemove: (() -> Unit)? = null, | ||
| content: (@Composable () -> Unit)? = null, | ||
| ) { | ||
| BannerLayout( | ||
| type = type, | ||
| description = { | ||
| Text( | ||
| text = description, | ||
| color = colorResource(id = type.descriptionColor), | ||
| fontSize = 14.sp, | ||
| ) | ||
| }, | ||
| modifier = modifier, | ||
| title = title, | ||
| leftIcon = leftIcon, | ||
| leftIconColor = leftIconColor, | ||
| rightIcon = rightIcon, | ||
| onClick = onClick, | ||
| onRemove = onRemove, | ||
| content = content, | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| fun Banner( | ||
| type: BannerType, | ||
| description: String, | ||
| modifier: Modifier = Modifier, | ||
| title: String? = null, | ||
| leftIcon: Painter? = null, | ||
| leftIconColor: Color = Color.Unspecified, | ||
| rightIcon: Painter? = null, | ||
| onClick: (() -> Unit)? = null, | ||
| onRemove: (() -> Unit)? = null, | ||
| content: (@Composable () -> Unit)? = null, | ||
| ) { | ||
|
Comment on lines
+175
to
+187
Contributor
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. 기본 파라미터 값 때문에 deprecated 된 Banner의 오버로드와 호출부의 형태가 겹쳐버리는 것 같아요. 기존에 라이브러리를 사용하는 곳에서 |
||
| BannerLayout( | ||
| type = type, | ||
| description = { | ||
| Text( | ||
| text = description, | ||
| color = colorResource(id = type.descriptionColor), | ||
| fontSize = 14.sp, | ||
| ) | ||
| }, | ||
| modifier = modifier, | ||
| title = title, | ||
| leftIcon = leftIcon, | ||
| leftIconColor = leftIconColor, | ||
| rightIcon = rightIcon, | ||
| onClick = onClick, | ||
| onRemove = onRemove, | ||
| content = content, | ||
|
|
@@ -107,8 +183,9 @@ private fun BannerLayout( | |
| description: @Composable () -> Unit, | ||
| modifier: Modifier, | ||
| title: String?, | ||
| icon: Painter?, | ||
| iconColor: Color, | ||
| leftIcon: Painter?, | ||
| leftIconColor: Color, | ||
| rightIcon: Painter?, | ||
| onClick: (() -> Unit)?, | ||
| onRemove: (() -> Unit)?, | ||
|
Comment on lines
+216
to
218
Contributor
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. rightIcon를 커스텀할 수 있음으로써 onClick과 onRemove의 차이에 대해 인지하기가 어려울 것으로 우려돼요.
Contributor
Author
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. onClick으로 통합하면 X버튼을 눌러서 닫는 느낌이 아니라 배너 어디든 클릭해서 닫힐거 같아서 뭔가 구분이 필요해 보입니다. |
||
| content: (@Composable () -> Unit)?, | ||
|
|
@@ -137,13 +214,13 @@ private fun BannerLayout( | |
| } | ||
| .padding(vertical = 10.dp, horizontal = 8.dp), | ||
| ) { | ||
| if (icon != null) { | ||
| if (leftIcon != null) { | ||
| Icon( | ||
| modifier = Modifier | ||
| .padding(start = 6.dp, top = 5.dp, bottom = 5.dp) | ||
| .size(20.dp), | ||
| painter = icon, | ||
| tint = iconColor.takeOrElse { BezierTheme.colors.txtBlackDark }, | ||
| painter = leftIcon, | ||
| tint = leftIconColor.takeOrElse { BezierTheme.colors.txtBlackDark }, | ||
| contentDescription = null, | ||
| ) | ||
| } | ||
|
|
@@ -195,7 +272,7 @@ private fun BannerLayout( | |
| modifier = Modifier | ||
| .size(30.dp) | ||
| .padding(5.dp), | ||
| painter = painterResource(id = R.drawable.icon_chevron_small_right), | ||
| painter = rightIcon ?: painterResource(id = R.drawable.icon_chevron_small_right), | ||
| tint = BezierTheme.colors.txtBlackDark, | ||
| contentDescription = null, | ||
| ) | ||
|
|
@@ -233,8 +310,8 @@ private fun FloatingBannerPreview() { | |
| type = BannerType.Floating, | ||
| title = null, | ||
| description = "componet ia properies, parent cmobil iespetc", | ||
| icon = painterResource(id = R.drawable.icon_lock), | ||
| iconColor = BezierTheme.colors.txtBlackDark, | ||
| leftIcon = painterResource(id = R.drawable.icon_lock), | ||
| leftIconColor = BezierTheme.colors.txtBlackDark, | ||
| onRemove = {}, | ||
| ) | ||
| } | ||
|
|
@@ -247,8 +324,8 @@ private fun CardBannerPreview() { | |
| type = BannerType.Card, | ||
| title = null, | ||
| description = "componet ia properies, parent cmobil iespetc", | ||
| icon = painterResource(id = R.drawable.icon_lock), | ||
| iconColor = BezierTheme.colors.txtBlackDark, | ||
| leftIcon = painterResource(id = R.drawable.icon_lock), | ||
| leftIconColor = BezierTheme.colors.txtBlackDark, | ||
| onRemove = {}, | ||
| ) | ||
| } | ||
|
|
@@ -262,8 +339,8 @@ private fun InnerBannerPreview() { | |
| type = BannerType.Inner, | ||
| title = "componet ia properies, palent", | ||
| description = "shape viw imlaouy", | ||
| icon = painterResource(id = R.drawable.icon_lock), | ||
| iconColor = BezierTheme.colors.txtBlackDark, | ||
| leftIcon = painterResource(id = R.drawable.icon_lock), | ||
| leftIconColor = BezierTheme.colors.txtBlackDark, | ||
| onRemove = {}, | ||
| ) { | ||
| Box( | ||
|
|
@@ -285,8 +362,8 @@ private fun InnerBannerWithoutTitlePreview() { | |
| type = BannerType.Inner, | ||
| title = null, | ||
| description = "shape viw imlaouy", | ||
| icon = painterResource(id = R.drawable.icon_lock), | ||
| iconColor = BezierTheme.colors.txtBlackDark, | ||
| leftIcon = painterResource(id = R.drawable.icon_lock), | ||
| leftIconColor = BezierTheme.colors.txtBlackDark, | ||
| onRemove = {}, | ||
| ) | ||
| } | ||
|
|
@@ -318,8 +395,8 @@ private fun BannerOnRemovePreview() { | |
| type = BannerType.Inner, | ||
| title = "componet ia properies, palent", | ||
| description = "shape viw imlaouy", | ||
| icon = painterResource(id = R.drawable.icon_lock), | ||
| iconColor = BezierTheme.colors.txtBlackDark, | ||
| leftIcon = painterResource(id = R.drawable.icon_lock), | ||
| leftIconColor = BezierTheme.colors.txtBlackDark, | ||
| onRemove = { visibleState = false }, | ||
| ) { | ||
| Box( | ||
|
|
@@ -345,8 +422,9 @@ private fun BannerOnClickPreview() { | |
| type = BannerType.Inner, | ||
| title = "componet ia properies, palent", | ||
| description = "shape viw imlaouy", | ||
| icon = painterResource(id = R.drawable.icon_lock), | ||
| iconColor = BezierTheme.colors.txtBlackDark, | ||
| leftIcon = painterResource(id = R.drawable.icon_lock), | ||
| leftIconColor = BezierTheme.colors.txtBlackDark, | ||
| rightIcon = painterResource(id = R.drawable.icon_chat_edit), | ||
| onClick = {}, | ||
| ) { | ||
| Box( | ||
|
|
@@ -372,8 +450,8 @@ private fun BannerOnClickOnRemovePreview() { | |
| type = BannerType.Inner, | ||
| title = "componet ia properies, palent", | ||
| description = "shape viw imlaouy", | ||
| icon = painterResource(id = R.drawable.icon_lock), | ||
| iconColor = BezierTheme.colors.txtBlackDark, | ||
| leftIcon = painterResource(id = R.drawable.icon_lock), | ||
| leftIconColor = BezierTheme.colors.txtBlackDark, | ||
| onClick = {}, | ||
| onRemove = {}, | ||
| ) { | ||
|
|
||
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.
rightIconColor는 필요 없나요? 넣는 게 나아보여서요
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.
라이트는 버튼 스펙을 따라가서 고정으로 생각해서 색상은 따로 넣지는 않았습니당
그래도 혹시 모르니 요건 디자인팀에 확인해볼게요