mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-08 20:38:41 +01:00
tweaked comment indentation style and elements
This commit is contained in:
parent
0d3186497d
commit
b54124ec72
@ -3,6 +3,7 @@ package com.livefast.eattrash.raccoonforlemmy.core.commonui.lemmyui
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@ -26,7 +27,7 @@ import com.livefast.eattrash.raccoonforlemmy.core.utils.toLocalDp
|
||||
import com.livefast.eattrash.raccoonforlemmy.domain.lemmy.data.CommentModel
|
||||
import com.livefast.eattrash.raccoonforlemmy.domain.lemmy.data.UserModel
|
||||
|
||||
private const val INDENT_AMOUNT = 3
|
||||
private const val INDENT_AMOUNT = 2
|
||||
|
||||
@Composable
|
||||
fun CollapsedCommentCard(
|
||||
@ -59,18 +60,26 @@ fun CollapsedCommentCard(
|
||||
depth = comment.depth,
|
||||
commentBarTheme = commentBarTheme,
|
||||
)
|
||||
Column(
|
||||
Row(
|
||||
modifier =
|
||||
modifier.onClick(
|
||||
onClick = onClick ?: {},
|
||||
),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width((INDENT_AMOUNT * comment.depth).dp),
|
||||
)
|
||||
if (comment.depth > 0) {
|
||||
Box(
|
||||
modifier =
|
||||
Modifier.padding(
|
||||
start = (INDENT_AMOUNT * comment.depth).dp,
|
||||
),
|
||||
) {
|
||||
Modifier
|
||||
.padding(top = Spacing.xxs)
|
||||
.width(INDENT_AMOUNT.dp)
|
||||
.height(commentHeight.toLocalDp())
|
||||
.background(color = barColor),
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier =
|
||||
Modifier
|
||||
@ -84,6 +93,7 @@ fun CollapsedCommentCard(
|
||||
},
|
||||
) {
|
||||
CommunityAndCreatorInfo(
|
||||
modifier = Modifier.padding(top = Spacing.xxs),
|
||||
iconSize = IconSize.s,
|
||||
creator = comment.creator,
|
||||
indicatorExpanded = comment.expanded,
|
||||
@ -121,16 +131,5 @@ fun CollapsedCommentCard(
|
||||
onOptionSelected = onOptionSelected,
|
||||
)
|
||||
}
|
||||
if (comment.depth > 0) {
|
||||
Box(
|
||||
modifier =
|
||||
Modifier
|
||||
.padding(top = Spacing.xxs)
|
||||
.width(barWidth)
|
||||
.height(commentHeight.toLocalDp())
|
||||
.background(color = barColor),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@ -117,9 +118,23 @@ fun CommentCard(
|
||||
onShare = onShareLambda,
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
Row(
|
||||
modifier = modifier,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width((indentAmount * comment.depth).dp)
|
||||
)
|
||||
if (indentAmount > 0 && comment.depth > 0) {
|
||||
Box(
|
||||
modifier =
|
||||
Modifier
|
||||
.padding(top = Spacing.xxs)
|
||||
.width(indentAmount.dp)
|
||||
.height(commentHeight.toLocalDp())
|
||||
.background(color = barColor, shape = RoundedCornerShape(indentAmount / 2)),
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier =
|
||||
Modifier
|
||||
@ -133,14 +148,6 @@ fun CommentCard(
|
||||
}
|
||||
},
|
||||
onDoubleClick = onDoubleClick ?: {},
|
||||
).padding(
|
||||
start =
|
||||
indentAmount
|
||||
.takeIf {
|
||||
it > 0 && comment.depth > 0
|
||||
}?.let {
|
||||
(it * comment.depth).dp + Spacing.xxxs
|
||||
} ?: 0.dp,
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
@ -252,16 +259,6 @@ fun CommentCard(
|
||||
onOptionSelected = onOptionSelected,
|
||||
)
|
||||
}
|
||||
if (indentAmount > 0 && comment.depth > 0) {
|
||||
Box(
|
||||
modifier =
|
||||
Modifier
|
||||
.padding(top = Spacing.xxs)
|
||||
.width(barWidth)
|
||||
.height(commentHeight.toLocalDp())
|
||||
.background(color = barColor, shape = RoundedCornerShape(barWidth / 2)),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user