Skip to content

Commit

Permalink
Force a white background for Dashboard tool cards
Browse files Browse the repository at this point in the history
  • Loading branch information
frett committed Sep 16, 2024
1 parent 53d1e5b commit 08c3ef9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ fun SquareToolCard(

ProvideLayoutDirectionFromLocale(locale = { state.translation?.languageCode }) {
ElevatedCard(
elevation = toolCardElevation,
onClick = { eventSink(ToolCard.Event.Click) },
colors = toolCardColors,
elevation = toolCardElevation,
modifier = modifier.width(189.dp)
) {
Box(modifier = Modifier.fillMaxWidth()) {
Expand Down
13 changes: 11 additions & 2 deletions app/src/main/kotlin/org/cru/godtools/ui/tools/ToolCardLayouts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CardDefaults.elevatedCardElevation
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.LocalContentColor
Expand Down Expand Up @@ -51,6 +52,12 @@ internal const val TEST_TAG_TOOL_CATEGORY = "tool_category"

internal val toolViewModels: ToolViewModels @Composable get() = viewModel()

internal val toolCardColors @Composable get() = CardDefaults.elevatedCardColors(
containerColor = when {
GodToolsTheme.isLightColorSchemeActive -> MaterialTheme.colorScheme.background
else -> Color.Unspecified
}
)
internal val toolCardElevation @Composable get() = elevatedCardElevation(defaultElevation = 4.dp)

internal val ToolCard.State.toolNameStyle: TextStyle
Expand Down Expand Up @@ -110,7 +117,6 @@ fun LessonToolCard(

ProvideLayoutDirectionFromLocale(locale = { translation?.languageCode }) {
ElevatedCard(
elevation = toolCardElevation,
onClick = {
onEvent(
ToolCardEvent.Click(
Expand All @@ -120,6 +126,8 @@ fun LessonToolCard(
)
)
},
colors = toolCardColors,
elevation = toolCardElevation,
modifier = modifier.fillMaxWidth()
) {
ToolBanner(state, modifier = Modifier.aspectRatio(335f / 80f))
Expand Down Expand Up @@ -207,9 +215,10 @@ fun ToolCard(

ProvideLayoutDirectionFromLocale(locale = { translation?.languageCode }) {
ElevatedCard(
onClick = { eventSink(ToolCard.Event.Click) },
colors = toolCardColors,
elevation = toolCardElevation,
interactionSource = interactionSource,
onClick = { eventSink(ToolCard.Event.Click) },
modifier = modifier
) {
Box(modifier = Modifier.fillMaxWidth()) {
Expand Down

0 comments on commit 08c3ef9

Please sign in to comment.