fix: highlighted comment background

This commit is contained in:
Diego Beraldin 2023-10-18 18:22:27 +02:00
parent e56f531468
commit bb24ac38d4
2 changed files with 22 additions and 18 deletions

View File

@ -16,7 +16,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Density
@ -34,7 +33,6 @@ import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.repository.CommentR
@Composable
fun CommentCard(
comment: CommentModel,
background: Color = MaterialTheme.colorScheme.background,
modifier: Modifier = Modifier,
separateUpAndDownVotes: Boolean = false,
hideAuthor: Boolean = false,
@ -59,7 +57,7 @@ fun CommentCard(
),
) {
Column(
modifier = modifier.background(background)
modifier = modifier
) {
var commentHeight by remember { mutableStateOf(0f) }
val barWidth = 2.dp

View File

@ -480,22 +480,28 @@ class PostDetailScreen(
},
content = {
CommentCard(
modifier = Modifier.onClick {
model.reduce(
PostDetailMviModel.Intent.ToggleExpandComment(
commentId,
modifier = Modifier
.background(MaterialTheme.colorScheme.background)
.let {
if (comment.id == highlightCommentId) {
it.background(
MaterialTheme.colorScheme.surfaceColorAtElevation(
5.dp
).copy(
alpha = 0.75f
)
)
} else {
it
}
}
.onClick {
model.reduce(
PostDetailMviModel.Intent.ToggleExpandComment(
commentId,
)
)
)
},
background = if (comment.id == highlightCommentId) {
MaterialTheme.colorScheme.surfaceColorAtElevation(
5.dp
).copy(
alpha = 0.75f
)
} else {
MaterialTheme.colorScheme.background
},
},
comment = comment,
separateUpAndDownVotes = uiState.separateUpAndDownVotes,
autoLoadImages = uiState.autoLoadImages,