Merge pull request #7576 from thunderbird/center_text

Center text in `LoadingView`, `SuccessView`, and `ErrorView`
This commit is contained in:
Wolf-Martell Montwé 2024-01-30 10:03:30 +00:00 committed by GitHub
commit e9416fe50f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View file

@ -13,6 +13,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.R
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
@ -54,6 +55,7 @@ fun ErrorView(
)
TextSubtitle1(
text = title,
textAlign = TextAlign.Center,
)
}

View file

@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.atom.CircularProgressIndicator
import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1
@ -36,7 +37,10 @@ fun LoadingView(
verticalArrangement = Arrangement.Center,
) {
if (message != null) {
TextSubtitle1(text = message)
TextSubtitle1(
text = message,
textAlign = TextAlign.Center,
)
}
Row(
modifier = Modifier.height(MainTheme.sizes.larger),

View file

@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.requiredSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.atom.Icon
import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1
@ -28,7 +29,10 @@ fun SuccessView(
.then(modifier),
horizontalAlignment = Alignment.CenterHorizontally,
) {
TextSubtitle1(text = message)
TextSubtitle1(
text = message,
textAlign = TextAlign.Center,
)
Row(
modifier = Modifier.height(MainTheme.sizes.larger),
verticalAlignment = Alignment.CenterVertically,
@ -47,7 +51,7 @@ fun SuccessView(
internal fun SuccessViewPreview() {
PreviewWithThemes {
SuccessView(
message = "Success",
message = "The app tried really hard and managed to successfully complete the operation.",
)
}
}