-
Notifications
You must be signed in to change notification settings - Fork 0
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
[TNT-185] 트레이니 마이페이지 UI 구현 #58
Changes from 15 commits
6b4e6a3
bf7bfd2
c9b2563
4f91321
30383ca
c4d3ee8
438dd3d
14287fb
2df84c1
23ffad1
046a5b5
e9c8421
7c0fcc5
863ed3a
c63a8c9
bdd9555
1baad73
ea65e4b
52f1b24
d93e336
f1f70a6
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 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,11 +1,12 @@ | ||||||||||||
package co.kr.tnt.designsystem.component.button | ||||||||||||
|
||||||||||||
import androidx.compose.foundation.BorderStroke | ||||||||||||
import androidx.compose.foundation.layout.Arrangement | ||||||||||||
import androidx.compose.foundation.layout.Column | ||||||||||||
import androidx.compose.foundation.layout.PaddingValues | ||||||||||||
import androidx.compose.foundation.layout.Row | ||||||||||||
import androidx.compose.foundation.layout.defaultMinSize | ||||||||||||
import androidx.compose.foundation.layout.fillMaxWidth | ||||||||||||
import androidx.compose.foundation.layout.height | ||||||||||||
import androidx.compose.foundation.layout.padding | ||||||||||||
import androidx.compose.foundation.layout.wrapContentSize | ||||||||||||
import androidx.compose.foundation.shape.RoundedCornerShape | ||||||||||||
import androidx.compose.material3.Button | ||||||||||||
|
@@ -17,6 +18,7 @@ import androidx.compose.ui.Alignment | |||||||||||
import androidx.compose.ui.Modifier | ||||||||||||
import androidx.compose.ui.graphics.RectangleShape | ||||||||||||
import androidx.compose.ui.res.painterResource | ||||||||||||
import androidx.compose.ui.text.style.TextOverflow | ||||||||||||
import androidx.compose.ui.tooling.preview.Preview | ||||||||||||
import androidx.compose.ui.unit.Dp | ||||||||||||
import androidx.compose.ui.unit.dp | ||||||||||||
|
@@ -45,14 +47,14 @@ fun TnTTextButton( | |||||||||||
color = type.borderColor(enabled), | ||||||||||||
), | ||||||||||||
contentPadding = size.contentPadding, | ||||||||||||
modifier = modifier | ||||||||||||
.height(size.height) | ||||||||||||
// Small, XSmall 버튼을 위해 Button minWidth 설정 | ||||||||||||
.defaultMinSize(minWidth = Dp.Hairline), | ||||||||||||
// Small, XSmall 버튼을 위해 Button minWidth, minHeight 설정 | ||||||||||||
modifier = modifier.defaultMinSize(minWidth = Dp.Hairline, minHeight = size.height), | ||||||||||||
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.
Suggested change
2줄 이상이면 줄바꿈 해주는게 좋을 것 같습니다! |
||||||||||||
) { | ||||||||||||
Text( | ||||||||||||
text = text, | ||||||||||||
style = size.textStyle(), | ||||||||||||
overflow = TextOverflow.Ellipsis, | ||||||||||||
maxLines = 1, | ||||||||||||
) | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
@@ -77,28 +79,40 @@ fun TnTIconButton( | |||||||||||
color = type.borderColor(enabled), | ||||||||||||
), | ||||||||||||
contentPadding = size.contentPadding, | ||||||||||||
modifier = modifier | ||||||||||||
.height(size.height) | ||||||||||||
// Small, XSmall 버튼을 위해 Button minWidth 설정 | ||||||||||||
.defaultMinSize(minWidth = Dp.Hairline), | ||||||||||||
// Small, XSmall 버튼을 위해 Button minWidth 설정 | ||||||||||||
modifier = modifier.defaultMinSize(minWidth = Dp.Hairline, minHeight = size.height), | ||||||||||||
) { | ||||||||||||
when (iconPosition) { | ||||||||||||
is IconPosition.Leading -> { | ||||||||||||
iconPosition.icon() | ||||||||||||
Text( | ||||||||||||
text = text, | ||||||||||||
style = size.textStyle(), | ||||||||||||
modifier = Modifier.padding(start = 4.dp), | ||||||||||||
) | ||||||||||||
Row( | ||||||||||||
verticalAlignment = Alignment.CenterVertically, | ||||||||||||
horizontalArrangement = Arrangement.spacedBy(4.dp), | ||||||||||||
) { | ||||||||||||
iconPosition.icon() | ||||||||||||
Text( | ||||||||||||
text = text, | ||||||||||||
style = size.textStyle(), | ||||||||||||
overflow = TextOverflow.Ellipsis, | ||||||||||||
maxLines = 1, | ||||||||||||
modifier = Modifier.weight(1f, false), | ||||||||||||
) | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
is IconPosition.Trailing -> { | ||||||||||||
Text( | ||||||||||||
text = text, | ||||||||||||
style = size.textStyle(), | ||||||||||||
modifier = Modifier.padding(end = 4.dp), | ||||||||||||
) | ||||||||||||
iconPosition.icon() | ||||||||||||
Row( | ||||||||||||
verticalAlignment = Alignment.CenterVertically, | ||||||||||||
horizontalArrangement = Arrangement.spacedBy(4.dp), | ||||||||||||
) { | ||||||||||||
Text( | ||||||||||||
text = text, | ||||||||||||
style = size.textStyle(), | ||||||||||||
overflow = TextOverflow.Ellipsis, | ||||||||||||
maxLines = 1, | ||||||||||||
modifier = Modifier.weight(1f, false), | ||||||||||||
) | ||||||||||||
iconPosition.icon() | ||||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
@@ -137,9 +151,9 @@ fun TnTBottomButton( | |||||||||||
fun TnTTnTTextButtonPreview() { | ||||||||||||
TnTTheme { | ||||||||||||
TnTTextButton( | ||||||||||||
size = ButtonSize.Medium, | ||||||||||||
size = ButtonSize.Small, | ||||||||||||
type = ButtonType.Primary, | ||||||||||||
text = "텍스트", | ||||||||||||
text = "텍스트ddddddddddddd", | ||||||||||||
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. 넵.. 고민 해보겠습니다ㅋㅋㅋ큐ㅜㅜ |
||||||||||||
enabled = true, | ||||||||||||
onClick = { }, | ||||||||||||
modifier = Modifier.wrapContentSize(), | ||||||||||||
|
@@ -154,32 +168,48 @@ private fun TnTOutLinedButtonPreview() { | |||||||||||
TnTTextButton( | ||||||||||||
size = ButtonSize.Medium, | ||||||||||||
type = ButtonType.RedOutline, | ||||||||||||
text = "텍스트", | ||||||||||||
text = "텍스트dddddddddddddddddddddd", | ||||||||||||
enabled = true, | ||||||||||||
onClick = { }, | ||||||||||||
modifier = Modifier.wrapContentSize(), | ||||||||||||
) | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
@Preview(showBackground = true, widthDp = 150, heightDp = 100) | ||||||||||||
@Preview(showBackground = true, widthDp = 150, heightDp = 130) | ||||||||||||
@Composable | ||||||||||||
private fun TnTIconButtonPreview() { | ||||||||||||
TnTTheme { | ||||||||||||
TnTIconButton( | ||||||||||||
size = ButtonSize.Medium, | ||||||||||||
type = ButtonType.GrayOutline, | ||||||||||||
iconPosition = IconPosition.Trailing { | ||||||||||||
Icon( | ||||||||||||
painter = painterResource(R.drawable.ic_delete), | ||||||||||||
contentDescription = null, | ||||||||||||
) | ||||||||||||
}, | ||||||||||||
text = "텍스트", | ||||||||||||
enabled = true, | ||||||||||||
onClick = { }, | ||||||||||||
modifier = Modifier.wrapContentSize(), | ||||||||||||
) | ||||||||||||
Column(verticalArrangement = Arrangement.spacedBy(5.dp)) { | ||||||||||||
TnTIconButton( | ||||||||||||
size = ButtonSize.Medium, | ||||||||||||
type = ButtonType.GrayOutline, | ||||||||||||
iconPosition = IconPosition.Trailing { | ||||||||||||
Icon( | ||||||||||||
painter = painterResource(R.drawable.ic_delete), | ||||||||||||
contentDescription = null, | ||||||||||||
) | ||||||||||||
}, | ||||||||||||
text = "텍스트ttttttttttttttttt", | ||||||||||||
enabled = true, | ||||||||||||
onClick = { }, | ||||||||||||
modifier = Modifier.wrapContentSize(), | ||||||||||||
) | ||||||||||||
TnTIconButton( | ||||||||||||
size = ButtonSize.Medium, | ||||||||||||
type = ButtonType.GrayOutline, | ||||||||||||
iconPosition = IconPosition.Leading { | ||||||||||||
Icon( | ||||||||||||
painter = painterResource(R.drawable.ic_delete), | ||||||||||||
contentDescription = null, | ||||||||||||
) | ||||||||||||
}, | ||||||||||||
text = "텍스트tttttttttttttttttt", | ||||||||||||
enabled = true, | ||||||||||||
onClick = { }, | ||||||||||||
modifier = Modifier.wrapContentSize(), | ||||||||||||
) | ||||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package co.kr.tnt.ui.component | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.defaultMinSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonColors | ||
import androidx.compose.material3.LocalMinimumInteractiveComponentSize | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import co.kr.tnt.designsystem.theme.TnTTheme | ||
|
||
@Composable | ||
fun TnTMyPageButton( | ||
text: String, | ||
verticalPadding: Dp, | ||
modifier: Modifier = Modifier, | ||
onClick: () -> Unit, | ||
) { | ||
CompositionLocalProvider(LocalMinimumInteractiveComponentSize provides 39.dp) { | ||
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. Material 3의 버튼과 같은 터치 가능한 컴포넌트는 최소 터치 영역(48.dp) 을 가지도록 설계되어 있습니다. 이로 인해 버튼 높이가 48.dp보다 작을 경우 자동으로 여백이 추가되는 문제가 발생했습니다! 이를 해결하기 위해 0.dp로 설정하지 않은 이유는 클릭은 가능하지만 리플 효과가 사라지기 때문입니다! 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. 오호 넵넵 ㅎㅎ 좋습니다!! |
||
Button( | ||
onClick = onClick, | ||
shape = RoundedCornerShape(12.dp), | ||
colors = ButtonColors( | ||
containerColor = TnTTheme.colors.commonColors.Common0, | ||
contentColor = TnTTheme.colors.neutralColors.Neutral700, | ||
disabledContainerColor = TnTTheme.colors.commonColors.Common0, | ||
disabledContentColor = TnTTheme.colors.neutralColors.Neutral700, | ||
), | ||
elevation = null, | ||
contentPadding = PaddingValues(horizontal = 20.dp, vertical = verticalPadding), | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.defaultMinSize(Dp.Hairline), | ||
) { | ||
Text( | ||
text = text, | ||
style = TnTTheme.typography.body2Medium, | ||
modifier = Modifier.fillMaxWidth(), | ||
overflow = TextOverflow.Ellipsis, | ||
maxLines = 1, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Preview(fontScale = 1.5f) | ||
@Composable | ||
private fun TnTMyPageButtonPreview() { | ||
TnTTheme { | ||
TnTMyPageButton( | ||
text = "트레이너와 연결하기", | ||
onClick = {}, | ||
verticalPadding = 8.dp, | ||
) | ||
} | ||
} |
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.
음.. 뭔가 네이밍이 버튼을 누르면 내부에서
checked
를 변화시킬 것 같은 느낌이에요!단순하게
onClick
도 괜찮아 보입니다!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.
좋습니다아! 수정해두겠습니다