Update text colors when the state is disabled.

This commit is contained in:
Benoit Marty 2025-08-18 16:38:16 +02:00 committed by Benoit Marty
parent 5d2246569f
commit 91369e9455
4 changed files with 15 additions and 8 deletions

View file

@ -50,6 +50,7 @@ fun CheckableUserRow(
avatarData = data.avatarData, avatarData = data.avatarData,
name = data.name, name = data.name,
subtext = data.subtext, subtext = data.subtext,
enabled = enabled,
) )
} }
is CheckableUserRowData.Unresolved -> { is CheckableUserRowData.Unresolved -> {
@ -57,11 +58,12 @@ fun CheckableUserRow(
modifier = rowModifier, modifier = rowModifier,
avatarData = data.avatarData, avatarData = data.avatarData,
id = data.id, id = data.id,
enabled = enabled,
) )
} }
} }
SelectedIndicatorAtom( SelectedIndicatorAtom(
modifier = modifier.padding(end = 24.dp), modifier = Modifier.padding(end = 24.dp),
checked = checked, checked = checked,
enabled = enabled, enabled = enabled,
) )

View file

@ -28,7 +28,7 @@ fun MatrixUserRow(
name = matrixUser.getBestName(), name = matrixUser.getBestName(),
subtext = if (matrixUser.displayName.isNullOrEmpty()) null else matrixUser.userId.value, subtext = if (matrixUser.displayName.isNullOrEmpty()) null else matrixUser.userId.value,
modifier = modifier, modifier = modifier,
trailingContent, trailingContent = trailingContent,
) )
@PreviewsDayNight @PreviewsDayNight

View file

@ -39,6 +39,7 @@ fun UnresolvedUserRow(
avatarData: AvatarData, avatarData: AvatarData,
id: String, id: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true,
) { ) {
Row( Row(
modifier = modifier modifier = modifier
@ -61,7 +62,7 @@ fun UnresolvedUserRow(
text = id, text = id,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
color = ElementTheme.colors.textPrimary, color = if (enabled) ElementTheme.colors.textPrimary else ElementTheme.colors.textDisabled,
style = ElementTheme.typography.fontBodyLgMedium, style = ElementTheme.typography.fontBodyLgMedium,
) )
@ -78,11 +79,11 @@ fun UnresolvedUserRow(
.size(18.dp) .size(18.dp)
.align(Alignment.Top) .align(Alignment.Top)
.padding(2.dp), .padding(2.dp),
tint = ElementTheme.colors.iconCriticalPrimary, tint = if (enabled) ElementTheme.colors.iconCriticalPrimary else ElementTheme.colors.iconDisabled,
) )
Text( Text(
text = stringResource(CommonStrings.common_invite_unknown_profile), text = stringResource(CommonStrings.common_invite_unknown_profile),
color = ElementTheme.colors.textSecondary, color = if (enabled) ElementTheme.colors.textSecondary else ElementTheme.colors.textDisabled,
style = ElementTheme.typography.fontBodySmRegular.copy(lineHeight = 16.sp), style = ElementTheme.typography.fontBodySmRegular.copy(lineHeight = 16.sp),
) )
} }
@ -94,5 +95,8 @@ fun UnresolvedUserRow(
@Composable @Composable
internal fun UnresolvedUserRowPreview() = ElementThemedPreview { internal fun UnresolvedUserRowPreview() = ElementThemedPreview {
val matrixUser = aMatrixUser() val matrixUser = aMatrixUser()
UnresolvedUserRow(matrixUser.getAvatarData(size = AvatarSize.UserListItem), matrixUser.userId.value) Column {
UnresolvedUserRow(matrixUser.getAvatarData(size = AvatarSize.UserListItem), matrixUser.userId.value)
UnresolvedUserRow(matrixUser.getAvatarData(size = AvatarSize.UserListItem), matrixUser.userId.value, enabled = false)
}
} }

View file

@ -30,6 +30,7 @@ internal fun UserRow(
name: String, name: String,
subtext: String?, subtext: String?,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true,
trailingContent: @Composable (() -> Unit)? = null, trailingContent: @Composable (() -> Unit)? = null,
) { ) {
Row( Row(
@ -54,14 +55,14 @@ internal fun UserRow(
text = name, text = name,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
color = ElementTheme.colors.textPrimary, color = if (enabled) ElementTheme.colors.textPrimary else ElementTheme.colors.textDisabled,
style = ElementTheme.typography.fontBodyLgRegular, style = ElementTheme.typography.fontBodyLgRegular,
) )
// Id // Id
subtext?.let { subtext?.let {
Text( Text(
text = subtext, text = subtext,
color = ElementTheme.colors.textSecondary, color = if (enabled) ElementTheme.colors.textSecondary else ElementTheme.colors.textDisabled,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodySmRegular, style = ElementTheme.typography.fontBodySmRegular,