From 76c4773aa5696b390c6074fdc8fd82b2bdfa9b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf-Martell=20Montw=C3=A9?= Date: Wed, 24 Apr 2024 17:20:46 +0200 Subject: [PATCH] Change account setup create account feature to theme 2 --- .../CreateAccountContentPreview.kt | 49 +++++++++++++++++++ .../CreateAccountScreenPreview.kt | 22 +++++++++ .../ui/createaccount/CreateAccountScreen.kt | 19 ------- 3 files changed, 71 insertions(+), 19 deletions(-) create mode 100644 feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountContentPreview.kt create mode 100644 feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreenPreview.kt diff --git a/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountContentPreview.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountContentPreview.kt new file mode 100644 index 000000000..1b096feb5 --- /dev/null +++ b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountContentPreview.kt @@ -0,0 +1,49 @@ +package app.k9mail.feature.account.setup.ui.createaccount + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.runtime.Composable +import androidx.compose.ui.tooling.preview.Preview +import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme +import app.k9mail.feature.account.setup.AccountSetupExternalContract.AccountCreator.AccountCreatorResult + +@Composable +@Preview(showBackground = true) +internal fun CreateAccountContentSuccessPreview() { + PreviewWithTheme { + CreateAccountContent( + state = CreateAccountContract.State( + isLoading = false, + error = null, + ), + contentPadding = PaddingValues(), + ) + } +} + +@Composable +@Preview(showBackground = true) +internal fun CreateAccountContentLoadingPreview() { + PreviewWithTheme { + CreateAccountContent( + state = CreateAccountContract.State( + isLoading = true, + error = null, + ), + contentPadding = PaddingValues(), + ) + } +} + +@Composable +@Preview(showBackground = true) +internal fun CreateAccountContentErrorPreview() { + PreviewWithTheme { + CreateAccountContent( + state = CreateAccountContract.State( + isLoading = false, + error = AccountCreatorResult.Error("Error message"), + ), + contentPadding = PaddingValues(), + ) + } +} diff --git a/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreenPreview.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreenPreview.kt new file mode 100644 index 000000000..e89a14e62 --- /dev/null +++ b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreenPreview.kt @@ -0,0 +1,22 @@ +package app.k9mail.feature.account.setup.ui.createaccount + +import androidx.compose.runtime.Composable +import app.k9mail.core.ui.compose.common.annotation.PreviewDevices +import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme +import app.k9mail.feature.account.common.data.InMemoryAccountStateRepository +import app.k9mail.feature.account.setup.AccountSetupExternalContract.AccountCreator.AccountCreatorResult + +@Composable +@PreviewDevices +internal fun AccountOptionsScreenK9Preview() { + PreviewWithTheme { + CreateAccountScreen( + onNext = {}, + onBack = {}, + viewModel = CreateAccountViewModel( + createAccount = { AccountCreatorResult.Success("irrelevant") }, + accountStateRepository = InMemoryAccountStateRepository(), + ), + ) + } +} diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreen.kt b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreen.kt index 2d2ab3717..1031f8749 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreen.kt +++ b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/createaccount/CreateAccountScreen.kt @@ -4,15 +4,11 @@ import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier -import app.k9mail.core.ui.compose.common.annotation.PreviewDevices import app.k9mail.core.ui.compose.common.mvi.observe import app.k9mail.core.ui.compose.designsystem.template.Scaffold -import app.k9mail.core.ui.compose.theme.K9Theme -import app.k9mail.feature.account.common.data.InMemoryAccountStateRepository import app.k9mail.feature.account.common.ui.AppTitleTopHeader import app.k9mail.feature.account.common.ui.WizardNavigationBar import app.k9mail.feature.account.common.ui.WizardNavigationBarState -import app.k9mail.feature.account.setup.AccountSetupExternalContract.AccountCreator.AccountCreatorResult import app.k9mail.feature.account.setup.domain.entity.AccountUuid import app.k9mail.feature.account.setup.ui.createaccount.CreateAccountContract.Effect import app.k9mail.feature.account.setup.ui.createaccount.CreateAccountContract.Event @@ -64,18 +60,3 @@ internal fun CreateAccountScreen( ) } } - -@Composable -@PreviewDevices -internal fun AccountOptionsScreenK9Preview() { - K9Theme { - CreateAccountScreen( - onNext = {}, - onBack = {}, - viewModel = CreateAccountViewModel( - createAccount = { AccountCreatorResult.Success("irrelevant") }, - accountStateRepository = InMemoryAccountStateRepository(), - ), - ) - } -}