Change account setup create account feature to theme 2

This commit is contained in:
Wolf-Martell Montwé 2024-04-24 17:20:46 +02:00
parent 1da0649085
commit 76c4773aa5
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
3 changed files with 71 additions and 19 deletions

View file

@ -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(),
)
}
}

View file

@ -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(),
),
)
}
}

View file

@ -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(),
),
)
}
}