Skip to content

Commit

Permalink
[FEAT/#16] isEnabled일 때의 상태 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jul 7, 2024
1 parent 0b7ea2e commit 7062258
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import com.terning.core.designsystem.theme.TerningTheme
@Composable
fun RectangleButton(
modifier: Modifier = Modifier,
isEnabled: Boolean = true,
text: String = "",
style: TextStyle,
paddingVertical: Dp,
onButtonClick: () -> Unit,
) {
TerningBasicButton(
modifier = modifier,
isEnabled = isEnabled,
shape = RoundedCornerShape(0.dp),
onButtonClick = onButtonClick,
text = text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -21,6 +22,7 @@ fun RoundButton(
) {
TerningBasicButton(
modifier = modifier,
isEnabled = isEnabled,
shape = RoundedCornerShape(roundedCornerShape),
onButtonClick = onButtonClick,
text = text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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() }
Expand Down

0 comments on commit 7062258

Please sign in to comment.