Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix special folder success and error view padding and text alignment #7477

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
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.atom.Icon
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
Expand Down Expand Up @@ -64,7 +65,6 @@ fun SpecialFoldersContent(
SuccessView(
message = stringResource(id = R.string.account_setup_special_folders_success_message),
onEditClick = { onEvent(Event.OnEditClicked) },
modifier = Modifier.fillMaxWidth(),
)
} else {
SpecialFoldersFormContent(
Expand All @@ -86,12 +86,15 @@ fun SuccessView(
Column(
modifier = Modifier
.fillMaxWidth()
.padding(MainTheme.spacings.default)
.padding(MainTheme.spacings.double)
.then(modifier),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
) {
TextSubtitle1(text = message)
TextSubtitle1(
text = message,
textAlign = TextAlign.Center,
)

Row(
modifier = Modifier.height(MainTheme.sizes.larger),
Expand Down Expand Up @@ -131,17 +134,63 @@ private fun SpecialFoldersErrorView(
title = stringResource(id = R.string.account_setup_special_folders_error_message),
message = message,
onRetry = onRetry,
modifier = Modifier
.fillMaxWidth()
.padding(MainTheme.spacings.double),
)
}

@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentPreview() {
internal fun SpecialFoldersContentLoadingPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = true,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}

@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentFormPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = false,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}

@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentSuccessPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = false,
isSuccess = true,
),
onEvent = {},
contentPadding = PaddingValues(),
)
}
}

@Preview(showBackground = true)
@Composable
internal fun SpecialFoldersContentErrorPreview() {
PreviewWithThemes {
SpecialFoldersContent(
state = State(
isLoading = false,
error = null,
error = SpecialFoldersContract.Failure.LoadFoldersFailed("Error"),
),
onEvent = {},
contentPadding = PaddingValues(),
Expand Down