Skip to content

Commit 9ebb530

Browse files
authored
Merge pull request thunderbird#8806 from marcRDZ/fix-8738_drawer-item-maxLines
Set maxLines and ellipsis on drawer folder labels
2 parents 5938fb8 + 9a2080e commit 9ebb530

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextLabelLarge.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.compose.ui.Modifier
55
import androidx.compose.ui.graphics.Color
66
import androidx.compose.ui.text.AnnotatedString
77
import androidx.compose.ui.text.style.TextAlign
8+
import androidx.compose.ui.text.style.TextOverflow
89
import app.k9mail.core.ui.compose.theme2.MainTheme
910
import androidx.compose.material3.Text as Material3Text
1011

@@ -14,12 +15,16 @@ fun TextLabelLarge(
1415
modifier: Modifier = Modifier,
1516
color: Color = Color.Unspecified,
1617
textAlign: TextAlign? = null,
18+
overflow: TextOverflow = TextOverflow.Ellipsis,
19+
maxLines: Int = Int.MAX_VALUE,
1720
) {
1821
Material3Text(
1922
text = text,
2023
modifier = modifier,
2124
color = color,
2225
textAlign = textAlign,
26+
maxLines = maxLines,
27+
overflow = overflow,
2328
style = MainTheme.typography.labelLarge,
2429
)
2530
}
@@ -30,12 +35,16 @@ fun TextLabelLarge(
3035
modifier: Modifier = Modifier,
3136
color: Color = Color.Unspecified,
3237
textAlign: TextAlign? = null,
38+
overflow: TextOverflow = TextOverflow.Ellipsis,
39+
maxLines: Int = Int.MAX_VALUE,
3340
) {
3441
Material3Text(
3542
text = text,
3643
modifier = modifier,
3744
color = color,
3845
textAlign = textAlign,
46+
maxLines = maxLines,
47+
overflow = overflow,
3948
style = MainTheme.typography.labelLarge,
4049
)
4150
}

core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/organism/drawer/NavigationDrawerItem.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fun NavigationDrawerItem(
1818
badge: (@Composable () -> Unit)? = null,
1919
) {
2020
Material3NavigationDrawerItem(
21-
label = { TextLabelLarge(text = label) },
21+
label = { TextLabelLarge(text = label, maxLines = 2) },
2222
selected = selected,
2323
onClick = onClick,
2424
modifier = Modifier
@@ -39,7 +39,7 @@ fun NavigationDrawerItem(
3939
badge: (@Composable () -> Unit)? = null,
4040
) {
4141
Material3NavigationDrawerItem(
42-
label = { TextLabelLarge(text = label) },
42+
label = { TextLabelLarge(text = label, maxLines = 2) },
4343
selected = selected,
4444
onClick = onClick,
4545
modifier = Modifier

0 commit comments

Comments
 (0)