|
| 1 | +package net.thunderbird.feature.mail.message.list.ui.component.atom |
| 2 | + |
| 3 | +import androidx.compose.foundation.background |
| 4 | +import androidx.compose.foundation.border |
| 5 | +import androidx.compose.foundation.layout.Box |
| 6 | +import androidx.compose.foundation.layout.padding |
| 7 | +import androidx.compose.foundation.layout.size |
| 8 | +import androidx.compose.foundation.shape.CircleShape |
| 9 | +import androidx.compose.runtime.Composable |
| 10 | +import androidx.compose.ui.Modifier |
| 11 | +import androidx.compose.ui.draw.clip |
| 12 | +import androidx.compose.ui.unit.dp |
| 13 | +import app.k9mail.core.ui.compose.theme2.MainTheme |
| 14 | + |
| 15 | +/** |
| 16 | + * A composable function that displays a badge indicator for new messages. |
| 17 | + * |
| 18 | + * The badge is rendered as a small circular shape filled with the primary theme color, |
| 19 | + * typically used to indicate the presence of new unread messages in a message list or conversation. |
| 20 | + * |
| 21 | + * @param modifier The modifier to be applied to the badge container. |
| 22 | + */ |
| 23 | +@Composable |
| 24 | +fun NewMessageBadge(modifier: Modifier = Modifier) { |
| 25 | + Box( |
| 26 | + modifier = modifier |
| 27 | + .size(size = 14.dp) |
| 28 | + .padding(all = 1.dp) |
| 29 | + .clip(CircleShape) |
| 30 | + .background(MainTheme.colors.primary), |
| 31 | + ) |
| 32 | +} |
| 33 | + |
| 34 | +/** |
| 35 | + * A composable function that displays a badge indicator for unread messages. |
| 36 | + * |
| 37 | + * The badge is rendered as a small circular shape with a surface background color and |
| 38 | + * a primary-colored border, typically used to indicate the presence of unread messages |
| 39 | + * that are not new in a message list or conversation. |
| 40 | + * |
| 41 | + * @param modifier The modifier to be applied to the badge container. |
| 42 | + */ |
| 43 | +@Composable |
| 44 | +fun UnreadMessageBadge(modifier: Modifier = Modifier) { |
| 45 | + Box( |
| 46 | + modifier = modifier |
| 47 | + .size(MainTheme.sizes.badge) |
| 48 | + .padding(MainTheme.spacings.quarter) |
| 49 | + .clip(CircleShape) |
| 50 | + .background(MainTheme.colors.surface) |
| 51 | + .border(width = 2.dp, color = MainTheme.colors.primary, shape = CircleShape), |
| 52 | + ) |
| 53 | +} |
0 commit comments