Skip to content

Commit

Permalink
fix: minor fixes in CatalogApp (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinaRomanova authored Aug 25, 2023
1 parent 24a5528 commit d739391
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -57,28 +55,19 @@ public val CheckboxExamples: List<Example> = 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(
Expand Down
6 changes: 3 additions & 3 deletions catalog/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<string name="theme_picker_text_direction_title" description="Simulate system text direction to be either LTR or RTL. [CHAR_LIMIT=NONE]">Text direction</string>
<string name="theme_picker_font_scale_title" description="Simulate a11y font scaling. [CHAR_LIMIT=NONE]">Font scale</string>
<string name="examples_component_screen_title">Components examples</string>
<string name="examples_component_screen_description">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.</string>
<string name="component_button_description">Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.</string>
<string name="examples_component_screen_description">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.</string>
<string name="component_button_description">Buttons help people initiate actions, like sending an email, sharing a document,or liking a post.</string>
<!--Toggle example-->
<string name="component_toggle_vertical_group_title">Toggle grouping with vertical alignment</string>
<string name="component_toggle_horizontal_group_title">Toggle grouping with horizontal alignment</string>
Expand All @@ -62,7 +62,7 @@
<string name="component_switch_description">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).</string>

<string name="configurator_component_screen_title">Components configurations</string>
<string name="configurator_component_screen_description">The Configurator aim to allow you to visualize a component in every possible state available state by customizing every property for each component.</string>
<string name="configurator_component_screen_description">The Configurator allows to visualize a component in every possible state available by customizing every property for each component.</string>
<string name="configurator_component_screen_enabled_label">Enabled</string>
<string name="configurator_component_screen_textfield_label">Label</string>
<string name="configurator_component_screen_intent_label">Intent</string>
Expand Down

0 comments on commit d739391

Please sign in to comment.