Pinned messages banner : reformat.

This commit is contained in:
ganfra 2024-09-06 16:32:29 +02:00
parent b35b31aa6f
commit 1ab7841443

View file

@ -91,16 +91,16 @@ private fun PinnedMessagesBannerRow(
val borderColor = ElementTheme.colors.pinnedMessageBannerBorder val borderColor = ElementTheme.colors.pinnedMessageBannerBorder
Row( Row(
modifier = modifier modifier = modifier
.background(color = ElementTheme.colors.bgCanvasDefault) .background(color = ElementTheme.colors.bgCanvasDefault)
.fillMaxWidth() .fillMaxWidth()
.drawBorder(borderColor) .drawBorder(borderColor)
.heightIn(min = 64.dp) .heightIn(min = 64.dp)
.clickable { .clickable {
if (state is PinnedMessagesBannerState.Loaded) { if (state is PinnedMessagesBannerState.Loaded) {
onClick(state.currentPinnedMessage.eventId) onClick(state.currentPinnedMessage.eventId)
state.eventSink(PinnedMessagesBannerEvents.MoveToNextPinned) state.eventSink(PinnedMessagesBannerEvents.MoveToNextPinned)
} }
}, },
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = spacedBy(10.dp) horizontalArrangement = spacedBy(10.dp)
) { ) {
@ -146,23 +146,23 @@ private fun ViewAllButton(
private fun Modifier.drawBorder(borderColor: Color): Modifier { private fun Modifier.drawBorder(borderColor: Color): Modifier {
return this return this
.drawBehind { .drawBehind {
val strokeWidth = 0.5.dp.toPx() val strokeWidth = 0.5.dp.toPx()
val y = size.height - strokeWidth / 2 val y = size.height - strokeWidth / 2
drawLine( drawLine(
borderColor, borderColor,
Offset(0f, y), Offset(0f, y),
Offset(size.width, y), Offset(size.width, y),
strokeWidth strokeWidth
) )
drawLine( drawLine(
borderColor, borderColor,
Offset(0f, 0f), Offset(0f, 0f),
Offset(size.width, 0f), Offset(size.width, 0f),
strokeWidth strokeWidth
) )
} }
.shadow(elevation = 5.dp, spotColor = Color.Transparent) .shadow(elevation = 5.dp, spotColor = Color.Transparent)
} }
@Composable @Composable
@ -203,17 +203,17 @@ private fun PinIndicators(
for (index in 0 until indicatorsCount) { for (index in 0 until indicatorsCount) {
Box( Box(
modifier = Modifier modifier = Modifier
.width(2.dp) .width(2.dp)
.height(indicatorHeight.dp) .height(indicatorHeight.dp)
.background( .background(
color = if (index == activeIndex) { color = if (index == activeIndex) {
ElementTheme.colors.iconAccentPrimary ElementTheme.colors.iconAccentPrimary
} else if (index < shownIndicators) { } else if (index < shownIndicators) {
ElementTheme.colors.pinnedMessageBannerIndicator ElementTheme.colors.pinnedMessageBannerIndicator
} else { } else {
Color.Transparent Color.Transparent
} }
), ),
) )
} }
} }