Skip to content

Commit

Permalink
buttons: revert small buttons in Card()
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Mar 23, 2022
1 parent bea3cdb commit 7b45582
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
Expand All @@ -22,7 +20,6 @@ import androidx.compose.ui.unit.dp
import kiwi.orbit.compose.catalog.Screen
import kiwi.orbit.compose.illustrations.Illustrations
import kiwi.orbit.compose.ui.OrbitTheme
import kiwi.orbit.compose.ui.controls.ButtonPrimary
import kiwi.orbit.compose.ui.controls.Card
import kiwi.orbit.compose.ui.controls.Separator
import kiwi.orbit.compose.ui.controls.Text
Expand Down Expand Up @@ -78,13 +75,7 @@ private fun CardScreenInner() {
} else null,
modifier = Modifier.fillMaxWidth(),
) {
Column(Modifier.padding(16.dp)) {
Image(Illustrations.AirHelp, contentDescription = null)
Spacer(Modifier.size(8.dp))
ButtonPrimary(onClick = {}) {
Text("Primary Button")
}
}
Image(Illustrations.AirHelp, contentDescription = null)
}
}
}
58 changes: 24 additions & 34 deletions ui/src/main/java/kiwi/orbit/compose/ui/controls/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.foundation.Indication
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -14,7 +13,6 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import kiwi.orbit.compose.ui.OrbitTheme
import kiwi.orbit.compose.ui.foundation.LocalSmallButtonScope
import kiwi.orbit.compose.ui.foundation.contentColorFor

@Composable
Expand All @@ -27,19 +25,15 @@ public fun Card(
elevation: Dp = 2.dp,
content: @Composable () -> Unit
) {
CompositionLocalProvider(
LocalSmallButtonScope provides true,
) {
Surface(
modifier = modifier,
shape = shape,
color = backgroundColor,
contentColor = contentColor,
elevation = elevation,
border = border,
content = content
)
}
Surface(
modifier = modifier,
shape = shape,
color = backgroundColor,
contentColor = contentColor,
elevation = elevation,
border = border,
content = content
)
}

@Composable
Expand All @@ -58,23 +52,19 @@ public fun Card(
role: Role? = null,
content: @Composable () -> Unit
) {
CompositionLocalProvider(
LocalSmallButtonScope provides true,
) {
Surface(
onClick = onClick,
modifier = modifier,
shape = shape,
color = backgroundColor,
contentColor = contentColor,
border = border,
elevation = elevation,
interactionSource = interactionSource,
indication = indication,
enabled = enabled,
onClickLabel = onClickLabel,
role = role,
content = content
)
}
Surface(
onClick = onClick,
modifier = modifier,
shape = shape,
color = backgroundColor,
contentColor = contentColor,
border = border,
elevation = elevation,
interactionSource = interactionSource,
indication = indication,
enabled = enabled,
onClickLabel = onClickLabel,
role = role,
content = content
)
}

0 comments on commit 7b45582

Please sign in to comment.