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.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
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.CommentModel
|
||||||
import com.livefast.eattrash.raccoonforlemmy.domain.lemmy.data.UserModel
|
import com.livefast.eattrash.raccoonforlemmy.domain.lemmy.data.UserModel
|
||||||
|
|
||||||
private const val INDENT_AMOUNT = 3
|
private const val INDENT_AMOUNT = 2
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CollapsedCommentCard(
|
fun CollapsedCommentCard(
|
||||||
@ -59,18 +60,26 @@ fun CollapsedCommentCard(
|
|||||||
depth = comment.depth,
|
depth = comment.depth,
|
||||||
commentBarTheme = commentBarTheme,
|
commentBarTheme = commentBarTheme,
|
||||||
)
|
)
|
||||||
Column(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
modifier.onClick(
|
modifier.onClick(
|
||||||
onClick = onClick ?: {},
|
onClick = onClick ?: {},
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width((INDENT_AMOUNT * comment.depth).dp),
|
||||||
|
)
|
||||||
|
if (comment.depth > 0) {
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.padding(
|
Modifier
|
||||||
start = (INDENT_AMOUNT * comment.depth).dp,
|
.padding(top = Spacing.xxs)
|
||||||
),
|
.width(INDENT_AMOUNT.dp)
|
||||||
) {
|
.height(commentHeight.toLocalDp())
|
||||||
|
.background(color = barColor),
|
||||||
|
)
|
||||||
|
}
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
@ -84,6 +93,7 @@ fun CollapsedCommentCard(
|
|||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
CommunityAndCreatorInfo(
|
CommunityAndCreatorInfo(
|
||||||
|
modifier = Modifier.padding(top = Spacing.xxs),
|
||||||
iconSize = IconSize.s,
|
iconSize = IconSize.s,
|
||||||
creator = comment.creator,
|
creator = comment.creator,
|
||||||
indicatorExpanded = comment.expanded,
|
indicatorExpanded = comment.expanded,
|
||||||
@ -121,16 +131,5 @@ fun CollapsedCommentCard(
|
|||||||
onOptionSelected = onOptionSelected,
|
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.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@ -117,9 +118,23 @@ fun CommentCard(
|
|||||||
onShare = onShareLambda,
|
onShare = onShareLambda,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Column(
|
Row(
|
||||||
modifier = modifier,
|
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(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
@ -133,14 +148,6 @@ fun CommentCard(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDoubleClick = onDoubleClick ?: {},
|
onDoubleClick = onDoubleClick ?: {},
|
||||||
).padding(
|
|
||||||
start =
|
|
||||||
indentAmount
|
|
||||||
.takeIf {
|
|
||||||
it > 0 && comment.depth > 0
|
|
||||||
}?.let {
|
|
||||||
(it * comment.depth).dp + Spacing.xxxs
|
|
||||||
} ?: 0.dp,
|
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
@ -252,16 +259,6 @@ fun CommentCard(
|
|||||||
onOptionSelected = onOptionSelected,
|
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