Skip to content

Commit 75eb39a

Browse files
author
Bořek Leikep
committed
On SegmentedSwitch, renamed optionFirst and optionSecond slots to optionOne and optionTwo.
1 parent 9fb3af5 commit 75eb39a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

catalog/src/main/java/kiwi/orbit/compose/catalog/screens/SegmentedSwitchScreen.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ private fun SegmentedSwitchScreenInner() {
5454
) {
5555
var selectedIndexFirst by rememberSaveable { mutableStateOf<Int?>(null) }
5656
SegmentedSwitch(
57-
optionFirst = { Text("Male") },
58-
optionSecond = { Text("Female") },
57+
optionOne = { Text("Male") },
58+
optionTwo = { Text("Female") },
5959
selectedIndex = selectedIndexFirst,
6060
onOptionClick = { index ->
6161
selectedIndexFirst = index.takeIf { index != selectedIndexFirst }

ui/src/androidMain/kotlin/kiwi/orbit/compose/ui/controls/SegmentedSwitch.kt

+10-10
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import kiwi.orbit.compose.ui.foundation.LocalTextStyle
4848
/**
4949
* A segmented switch displaying two options.
5050
*
51-
* Renders a segmented switch displaying [optionFirst] and [optionSecond].
51+
* Renders a segmented switch displaying [optionOne] and [optionTwo].
5252
* Modify via custom passed [modifier].
5353
* An information or error footer can be added to the field.
5454
*
@@ -57,8 +57,8 @@ import kiwi.orbit.compose.ui.foundation.LocalTextStyle
5757
* ```
5858
* var selectedIndex by remember { mutableStateOf<Int?>(null) }
5959
* SegmentedSwitch(
60-
* optionFirst = { Text("Off") },
61-
* optionSecond = { Text("On") },
60+
* optionOne = { Text("Off") },
61+
* optionTwo = { Text("On") },
6262
* selectedIndex = selectedIndex,
6363
* onOptionClick = { index -> selectedIndex = index },
6464
* label = { Text("Feature") },
@@ -69,8 +69,8 @@ import kiwi.orbit.compose.ui.foundation.LocalTextStyle
6969
@Composable
7070
public fun SegmentedSwitch(
7171
onOptionClick: (selectedIndex: Int) -> Unit,
72-
optionFirst: @Composable () -> Unit,
73-
optionSecond: @Composable () -> Unit,
72+
optionOne: @Composable () -> Unit,
73+
optionTwo: @Composable () -> Unit,
7474
selectedIndex: Int?,
7575
modifier: Modifier = Modifier,
7676
label: @Composable () -> Unit = {},
@@ -79,7 +79,7 @@ public fun SegmentedSwitch(
7979
) {
8080
SegmentedSwitch(
8181
onOptionClick = onOptionClick,
82-
options = listOf(optionFirst, optionSecond),
82+
options = listOf(optionOne, optionTwo),
8383
selectedIndex = selectedIndex,
8484
modifier = modifier,
8585
label = label,
@@ -287,8 +287,8 @@ internal fun SegmentedSwitchPreview() {
287287
private fun SegmentedSwitchUnselectedPreview() {
288288
var selectedIndex by remember { mutableStateOf<Int?>(null) }
289289
SegmentedSwitch(
290-
optionFirst = { Text("Male") },
291-
optionSecond = { Text("Female") },
290+
optionOne = { Text("Male") },
291+
optionTwo = { Text("Female") },
292292
selectedIndex = selectedIndex,
293293
onOptionClick = { index -> selectedIndex = index },
294294
label = { Text("Gender") },
@@ -299,8 +299,8 @@ private fun SegmentedSwitchUnselectedPreview() {
299299
private fun SegmentedSwitchSelectedPreview() {
300300
var selectedIndex by remember { mutableStateOf<Int?>(0) }
301301
SegmentedSwitch(
302-
optionFirst = { Text("Male") },
303-
optionSecond = { Text("Female") },
302+
optionOne = { Text("Male") },
303+
optionTwo = { Text("Female") },
304304
selectedIndex = selectedIndex,
305305
onOptionClick = { index -> selectedIndex = index },
306306
label = { Text("Gender") },

0 commit comments

Comments
 (0)