From d73939162dcdafcff931820704a416761f214ee8 Mon Sep 17 00:00:00 2001 From: Marina Romanova <36896406+MarinaRomanova@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:42:56 +0200 Subject: [PATCH] fix: minor fixes in CatalogApp (#673) --- .../samples/toggles/CheckboxExamples.kt | 31 ++++++------------- catalog/src/main/res/values/strings.xml | 6 ++-- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/toggles/CheckboxExamples.kt b/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/toggles/CheckboxExamples.kt index bac34f9d0..3a72a11cd 100644 --- a/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/toggles/CheckboxExamples.kt +++ b/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/toggles/CheckboxExamples.kt @@ -25,7 +25,6 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.selection.selectableGroup import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -46,7 +45,6 @@ import com.adevinta.spark.components.spacer.VerticalSpacer import com.adevinta.spark.components.toggles.Checkbox import com.adevinta.spark.components.toggles.CheckboxLabelled import com.adevinta.spark.components.toggles.ContentSide -import com.adevinta.spark.components.toggles.ToggleIntent private const val CheckboxExampleDescription = "Checkbox examples" private const val CheckboxExampleSourceUrl = "$SampleSourceUrl/CheckboxSamples.kt" @@ -57,28 +55,19 @@ public val CheckboxExamples: List = listOf( sourceUrl = CheckboxExampleSourceUrl, ) { var checkboxState by remember { mutableStateOf(ToggleableState.Off) } - LazyRow { - items( - ToggleIntent.values().count(), - itemContent = { index -> - val intent = ToggleIntent.values()[index] - Column { - Checkbox( - enabled = true, - state = checkboxState, - intent = intent, - onClick = { - checkboxState = when (checkboxState) { - ToggleableState.On -> ToggleableState.Off - ToggleableState.Off -> ToggleableState.Indeterminate - ToggleableState.Indeterminate -> ToggleableState.On - } - }, - ) - Checkbox(enabled = false, state = checkboxState, intent = intent, onClick = {}) + Column { + Checkbox( + enabled = true, + state = checkboxState, + onClick = { + checkboxState = when (checkboxState) { + ToggleableState.On -> ToggleableState.Off + ToggleableState.Off -> ToggleableState.Indeterminate + ToggleableState.Indeterminate -> ToggleableState.On } }, ) + Checkbox(enabled = false, state = checkboxState, onClick = {}) } }, Example( diff --git a/catalog/src/main/res/values/strings.xml b/catalog/src/main/res/values/strings.xml index 6705351e5..4927eea20 100644 --- a/catalog/src/main/res/values/strings.xml +++ b/catalog/src/main/res/values/strings.xml @@ -40,8 +40,8 @@ Text direction Font scale Components examples - These are the examples that that can be found in the samples in the javadoc or the README.md files. They show usages of the components in different scenarios that should represent real use cases. - Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post. + These are the examples that can be found in the samples in the javadoc or the README.md files. They show usages of the components with the default params in different scenarios that should represent real use cases. + Buttons help people initiate actions, like sending an email, sharing a document,or liking a post. Toggle grouping with vertical alignment Toggle grouping with horizontal alignment @@ -62,7 +62,7 @@ Switch component allows the user to activate or deactivate the state of an element or concept. It is also used to control binary options (On/Off or True/False). Components configurations - The Configurator aim to allow you to visualize a component in every possible state available state by customizing every property for each component. + The Configurator allows to visualize a component in every possible state available by customizing every property for each component. Enabled Label Intent