mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-10 08:10:40 +01:00
fix: highlighted comment background
This commit is contained in:
parent
e56f531468
commit
bb24ac38d4
@ -16,7 +16,6 @@ import androidx.compose.runtime.mutableStateOf
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.layout.onGloballyPositioned
|
import androidx.compose.ui.layout.onGloballyPositioned
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.unit.Density
|
import androidx.compose.ui.unit.Density
|
||||||
@ -34,7 +33,6 @@ import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.repository.CommentR
|
|||||||
@Composable
|
@Composable
|
||||||
fun CommentCard(
|
fun CommentCard(
|
||||||
comment: CommentModel,
|
comment: CommentModel,
|
||||||
background: Color = MaterialTheme.colorScheme.background,
|
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
separateUpAndDownVotes: Boolean = false,
|
separateUpAndDownVotes: Boolean = false,
|
||||||
hideAuthor: Boolean = false,
|
hideAuthor: Boolean = false,
|
||||||
@ -59,7 +57,7 @@ fun CommentCard(
|
|||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier.background(background)
|
modifier = modifier
|
||||||
) {
|
) {
|
||||||
var commentHeight by remember { mutableStateOf(0f) }
|
var commentHeight by remember { mutableStateOf(0f) }
|
||||||
val barWidth = 2.dp
|
val barWidth = 2.dp
|
||||||
|
@ -480,21 +480,27 @@ class PostDetailScreen(
|
|||||||
},
|
},
|
||||||
content = {
|
content = {
|
||||||
CommentCard(
|
CommentCard(
|
||||||
modifier = Modifier.onClick {
|
modifier = Modifier
|
||||||
model.reduce(
|
.background(MaterialTheme.colorScheme.background)
|
||||||
PostDetailMviModel.Intent.ToggleExpandComment(
|
.let {
|
||||||
commentId,
|
if (comment.id == highlightCommentId) {
|
||||||
)
|
it.background(
|
||||||
)
|
|
||||||
},
|
|
||||||
background = if (comment.id == highlightCommentId) {
|
|
||||||
MaterialTheme.colorScheme.surfaceColorAtElevation(
|
MaterialTheme.colorScheme.surfaceColorAtElevation(
|
||||||
5.dp
|
5.dp
|
||||||
).copy(
|
).copy(
|
||||||
alpha = 0.75f
|
alpha = 0.75f
|
||||||
)
|
)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.background
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onClick {
|
||||||
|
model.reduce(
|
||||||
|
PostDetailMviModel.Intent.ToggleExpandComment(
|
||||||
|
commentId,
|
||||||
|
)
|
||||||
|
)
|
||||||
},
|
},
|
||||||
comment = comment,
|
comment = comment,
|
||||||
separateUpAndDownVotes = uiState.separateUpAndDownVotes,
|
separateUpAndDownVotes = uiState.separateUpAndDownVotes,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user