Skip to content

Commit

Permalink
[REFACTOR/#16] Button Component ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonsuKang committed Jan 8, 2025
1 parent 354b671 commit c0adf0c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions core/ui/src/main/java/com/yapp/ui/component/button/OrbitButton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,43 @@ fun OrbitButton(
label: String,
modifier: Modifier = Modifier,
onClick: () -> Unit,
enabled: Boolean = true,
enabled: Boolean = false,
height: Dp = 54.dp,
containerColor: Color = OrbitTheme.colors.main,
contentColor: Color = OrbitTheme.colors.gray_900,
pressedContentColor: Color = OrbitTheme.colors.gray_400,
disabledContainerColor: Color = OrbitTheme.colors.main.copy(alpha = 0.6f),
disabledContentColor: Color = OrbitTheme.colors.gray_400,
pressedContainerColor: Color = OrbitTheme.colors.main.copy(alpha = 0.8f),
pressedContentColor: Color = OrbitTheme.colors.gray_600,
disabledContainerColor: Color = OrbitTheme.colors.gray_700,
disabledContentColor: Color = OrbitTheme.colors.gray_600,
) {
val interactionSource = remember { MutableInteractionSource() }
val isPressed = interactionSource.collectIsPressedAsState().value
val currentContentColor = if (isPressed) pressedContentColor else contentColor

val padding by animateDpAsState(
targetValue = if (isPressed) 2.dp else 0.dp,
animationSpec = tween(durationMillis = 100),
label = "",
label = "PaddingAnimation",
)

Button(
onClick = onClick,
enabled = enabled,
shape = RoundedCornerShape(16.dp),
colors = ButtonDefaults.buttonColors(
containerColor = containerColor,
contentColor = currentContentColor,
containerColor = if (isPressed) pressedContainerColor else containerColor,
contentColor = if (isPressed) pressedContentColor else contentColor,
disabledContainerColor = disabledContainerColor,
disabledContentColor = disabledContentColor,
),
interactionSource = interactionSource,
modifier = modifier
.fillMaxWidth()
.padding(all = padding)
.height(height),
.padding(padding)
.height(height - padding * 2),
) {
Text(
text = label,
style = OrbitTheme.typography.heading1SemiBold,
style = OrbitTheme.typography.body1SemiBold,
)
}
}
Expand Down

0 comments on commit c0adf0c

Please sign in to comment.