11package net.thunderbird.feature.mail.message.list.ui.component.molecule
22
3+ import androidx.compose.foundation.background
34import androidx.compose.foundation.border
5+ import androidx.compose.foundation.layout.Box
46import androidx.compose.foundation.layout.padding
57import androidx.compose.runtime.Composable
8+ import androidx.compose.ui.Alignment
69import androidx.compose.ui.Modifier
710import androidx.compose.ui.graphics.Color
811import androidx.compose.ui.text.SpanStyle
912import androidx.compose.ui.text.buildAnnotatedString
1013import androidx.compose.ui.text.font.FontWeight
1114import androidx.compose.ui.text.withStyle
1215import androidx.compose.ui.unit.dp
13- import app.k9mail.core.ui.compose.designsystem.atom.Surface
1416import app.k9mail.core.ui.compose.designsystem.atom.text.TextLabelSmall
1517import app.k9mail.core.ui.compose.theme2.MainTheme
1618
19+ internal const val MESSAGE_CONVERSATION_COUNTER_BADGE_PADDING = 3
20+
1721/* *
1822 * A composable that displays a message conversation counter badge with a customizable appearance.
1923 *
@@ -36,15 +40,19 @@ internal fun MessageConversationCounterBadge(
3640 modifier : Modifier = Modifier ,
3741 limit : Int = MessageConversationCounterBadgeDefaults .CONVERSATION_COUNTER_LIMIT ,
3842) {
39- Surface (
40- color = color.containerColor,
41- contentColor = color.contentColor,
42- shape = MainTheme .shapes.large,
43- modifier = modifier.border(
44- width = 1 .dp,
45- color = color.borderColor ? : color.containerColor,
46- shape = MainTheme .shapes.large,
47- ),
43+ Box (
44+ modifier = modifier
45+ .background(
46+ color = color.containerColor,
47+ shape = MainTheme .shapes.large,
48+ )
49+ .border(
50+ width = 1 .dp,
51+ color = color.borderColor ? : color.containerColor,
52+ shape = MainTheme .shapes.large,
53+ )
54+ .padding(horizontal = MainTheme .spacings.half, vertical = MESSAGE_CONVERSATION_COUNTER_BADGE_PADDING .dp),
55+ contentAlignment = Alignment .Center ,
4856 ) {
4957 TextLabelSmall (
5058 text = buildAnnotatedString {
@@ -55,7 +63,7 @@ internal fun MessageConversationCounterBadge(
5563 }
5664 }
5765 },
58- modifier = Modifier .padding(horizontal = MainTheme .spacings.half, vertical = MainTheme .spacings.quarter) ,
66+ color = color.contentColor ,
5967 )
6068 }
6169}
0 commit comments