Remove TextBody2 and replace by TextBodyMedium

This commit is contained in:
Wolf-Martell Montwé 2024-04-22 14:21:47 +02:00
parent ad1464567d
commit 31b69be8b2
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
6 changed files with 8 additions and 86 deletions

View file

@ -7,7 +7,6 @@ import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody2
import app.k9mail.core.ui.compose.designsystem.atom.text.TextButton
import app.k9mail.core.ui.compose.designsystem.atom.text.TextCaption
import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline1
@ -96,13 +95,6 @@ private fun LazyGridScope.textItems(
color = color,
)
}
item {
TextBody2(
text = annotatedString("Body2", isAnnotated),
modifier = Modifier.itemDefaultPadding(),
color = color,
)
}
item {
TextButton(
text = annotatedString("Button", isAnnotated),

View file

@ -1,70 +0,0 @@
package app.k9mail.core.ui.compose.designsystem.atom.text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import androidx.compose.material.Text as MaterialText
@Composable
fun TextBody2(
text: String,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
textAlign: TextAlign? = null,
) {
MaterialText(
text = text,
modifier = modifier,
color = color,
textAlign = textAlign,
style = MainTheme.typography.body2,
)
}
@Composable
fun TextBody2(
text: AnnotatedString,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
textAlign: TextAlign? = null,
) {
MaterialText(
text = text,
modifier = modifier,
color = color,
textAlign = textAlign,
style = MainTheme.typography.body2,
)
}
@Preview(showBackground = true)
@Composable
internal fun TextBody2Preview() {
PreviewWithThemes {
TextBody2(text = "TextBody2")
}
}
@Preview(showBackground = true)
@Composable
internal fun TextBody2WithAnnotatedStringPreview() {
PreviewWithThemes {
TextBody2(
text = buildAnnotatedString {
append("Normal")
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
append("Annotated")
}
},
)
}
}

View file

@ -19,7 +19,7 @@ import app.k9mail.autodiscovery.api.SmtpServerSettings
import app.k9mail.core.common.net.toHostname
import app.k9mail.core.common.net.toPort
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody2
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.feature.account.setup.R
@ -39,7 +39,7 @@ internal fun AutoDiscoveryResultBodyView(
) {
if (settings.isTrusted.not()) {
Spacer(modifier = Modifier.height(MainTheme.sizes.smaller))
TextBody2(
TextBodyMedium(
text = stringResource(
id = R.string.account_setup_auto_discovery_result_disclaimer_untrusted_configuration,
),

View file

@ -13,7 +13,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody2
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium
import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline6
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
@ -50,7 +50,7 @@ internal fun AutoDiscoveryResultHeaderView(
TextHeadline6(
text = stringResource(state.titleResourceId),
)
TextBody2(
TextBodyMedium(
text = stringResource(state.subtitleResourceId),
color = selectColor(state),
)

View file

@ -22,8 +22,8 @@ import app.k9mail.core.common.net.isIpAddress
import app.k9mail.core.common.net.toHostname
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody2
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyLarge
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.feature.account.setup.ui.autodiscovery.toAutoDiscoveryConnectionSecurityString
@ -111,7 +111,7 @@ private fun ServerSettingRow(
modifier = Modifier.padding(end = MainTheme.spacings.default),
)
}
TextBody2(
TextBodyMedium(
text = text,
)
}

View file

@ -24,7 +24,7 @@ import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonFilled
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons
import app.k9mail.core.ui.compose.designsystem.atom.icon.IconsWithBottomRightOverlay
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody2
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium
import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline6
import app.k9mail.core.ui.compose.theme.K9Theme
import app.k9mail.core.ui.compose.theme.MainTheme
@ -58,7 +58,7 @@ internal fun PermissionBox(
}
Column {
TextHeadline6(text = title)
TextBody2(text = description)
TextBodyMedium(text = description)
}
}