diff --git a/core/ui/src/main/kotlin/nl/q42/template/ui/compose/composables/widgets/TemplateButton.kt b/core/ui/src/main/kotlin/nl/q42/template/ui/compose/composables/widgets/TemplateButton.kt index fae0c7e..d0e253b 100644 --- a/core/ui/src/main/kotlin/nl/q42/template/ui/compose/composables/widgets/TemplateButton.kt +++ b/core/ui/src/main/kotlin/nl/q42/template/ui/compose/composables/widgets/TemplateButton.kt @@ -8,12 +8,15 @@ import nl.q42.template.ui.theme.AppTheme import nl.q42.template.ui.theme.PreviewLightDark @Composable -fun TemplateButton(text: String, onClick: () -> Unit) { +fun TemplateButton(text: String, enabled: Boolean = true, onClick: () -> Unit) { Button( onClick = onClick, + enabled = enabled, colors = ButtonDefaults.buttonColors( containerColor = AppTheme.colors.accent, - contentColor = AppTheme.colors.buttonText + contentColor = AppTheme.colors.buttonText, + disabledContentColor = AppTheme.colors.buttonText.copy(alpha = 0.5f), + disabledContainerColor = AppTheme.colors.accent.copy(alpha = 0.5f) ) ) { Text( @@ -28,6 +31,6 @@ fun TemplateButton(text: String, onClick: () -> Unit) { @PreviewLightDark private fun TemplateButtonPreview() { AppTheme { - TemplateButton("Button", {}) + TemplateButton("Button",) {} } } \ No newline at end of file diff --git a/feature/home/src/main/kotlin/nl/q42/template/home/main/ui/HomeContent.kt b/feature/home/src/main/kotlin/nl/q42/template/home/main/ui/HomeContent.kt index ed2c486..2f5e051 100644 --- a/feature/home/src/main/kotlin/nl/q42/template/home/main/ui/HomeContent.kt +++ b/feature/home/src/main/kotlin/nl/q42/template/home/main/ui/HomeContent.kt @@ -53,11 +53,13 @@ internal fun HomeContent( horizontalAlignment = CenterHorizontally, verticalArrangement = spacedBy(Dimens.buttonSpacingVertical) ) { - TemplateButton("Refresh", onLoadClicked) + TemplateButton("Refresh", onClick = onLoadClicked) - TemplateButton("Open second screen", onOpenSecondScreenClicked) + TemplateButton("Open second screen", onClick = onOpenSecondScreenClicked) - TemplateButton("Open Onboarding", onOpenOnboardingClicked) + TemplateButton("Open Onboarding", onClick = onOpenOnboardingClicked) + + TemplateButton("Disabled button", enabled = false) {} } } diff --git a/feature/home/src/main/kotlin/nl/q42/template/home/second/ui/HomeSecondScreen.kt b/feature/home/src/main/kotlin/nl/q42/template/home/second/ui/HomeSecondScreen.kt index bf3f638..1fe97e7 100644 --- a/feature/home/src/main/kotlin/nl/q42/template/home/second/ui/HomeSecondScreen.kt +++ b/feature/home/src/main/kotlin/nl/q42/template/home/second/ui/HomeSecondScreen.kt @@ -3,8 +3,6 @@ package nl.q42.template.home.second.ui import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material3.Button -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -44,6 +42,6 @@ fun HomeSecondScreen( Text(viewState.title, style = AppTheme.typography.h1, color = AppTheme.colors.textPrimary) - TemplateButton("Close", viewModel::onBackClicked) + TemplateButton("Close", onClick = viewModel::onBackClicked) } }