From 7062258b18b52946c0493b5b71c5cf94bf102a56 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 8 Jul 2024 02:08:38 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#16]=20isEnabled=EC=9D=BC=20=EB=95=8C?= =?UTF-8?q?=EC=9D=98=20=EC=83=81=ED=83=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/button/RectangleButton.kt | 2 ++ .../designsystem/component/button/RoundButton.kt | 2 ++ .../component/button/TerningBasicButton.kt | 12 +++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/RectangleButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/RectangleButton.kt index 0b4a942e8..d5ad56bbf 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/RectangleButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/RectangleButton.kt @@ -13,6 +13,7 @@ import com.terning.core.designsystem.theme.TerningTheme @Composable fun RectangleButton( modifier: Modifier = Modifier, + isEnabled: Boolean = true, text: String = "", style: TextStyle, paddingVertical: Dp, @@ -20,6 +21,7 @@ fun RectangleButton( ) { TerningBasicButton( modifier = modifier, + isEnabled = isEnabled, shape = RoundedCornerShape(0.dp), onButtonClick = onButtonClick, text = text, diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/RoundButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/RoundButton.kt index 3b66bc3ef..ccf43e196 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/RoundButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/RoundButton.kt @@ -13,6 +13,7 @@ import com.terning.core.designsystem.theme.TerningTheme @Composable fun RoundButton( modifier: Modifier = Modifier, + isEnabled: Boolean = true, text: String = "", style: TextStyle, paddingVertical: Dp, @@ -21,6 +22,7 @@ fun RoundButton( ) { TerningBasicButton( modifier = modifier, + isEnabled = isEnabled, shape = RoundedCornerShape(roundedCornerShape), onButtonClick = onButtonClick, text = text, diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt index 5d451e962..ae050648e 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/button/TerningBasicButton.kt @@ -18,6 +18,8 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningMain2 import com.terning.core.designsystem.theme.TerningPointTheme @@ -28,6 +30,7 @@ import com.terning.core.util.NoRippleTheme @Composable fun TerningBasicButton( modifier: Modifier = Modifier, + isEnabled: Boolean = true, text: String = "", shape: Shape, style: TextStyle, @@ -36,15 +39,18 @@ fun TerningBasicButton( ) { val interactionSource = remember { MutableInteractionSource() } val isPressed by interactionSource.collectIsPressedAsState() - val color = if (isPressed) TerningMain2 else TerningMain + val backgroundColor = if (isPressed) TerningMain2 else TerningMain CompositionLocalProvider(LocalRippleTheme provides NoRippleTheme) { Button( modifier = modifier.fillMaxWidth(), interactionSource = interactionSource, + enabled = isEnabled, colors = ButtonDefaults.buttonColors( - containerColor = color, - contentColor = White + containerColor = backgroundColor, + contentColor = White, + disabledContainerColor = Grey150, + disabledContentColor = Black ), shape = shape, onClick = { onButtonClick() }