From 1e012d5cd4c11293adf72cd3dd500d10bf39f54f Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Thu, 14 Sep 2023 19:15:10 +0530 Subject: [PATCH] Rename class to InputRadioButton --- .../kotlin/org/hisp/dhis/common/App.kt | 4 ++-- .../hisp/dhis/common/screens/Components.kt | 2 +- .../common/screens/RadioButtonInputScreen.kt | 12 +++++------ .../component/RadioButtonInput.kt | 4 ++-- ...onInputTest.kt => InputRadioButtonTest.kt} | 20 +++++++++---------- 5 files changed, 21 insertions(+), 21 deletions(-) rename designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/{RadioButtonInputTest.kt => InputRadioButtonTest.kt} (97%) diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt index 7a5bdab27..b2fa5e585 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt @@ -43,7 +43,7 @@ import org.hisp.dhis.common.screens.InputTextScreen import org.hisp.dhis.common.screens.LegendDescriptionScreen import org.hisp.dhis.common.screens.LegendScreen import org.hisp.dhis.common.screens.ProgressScreen -import org.hisp.dhis.common.screens.RadioButtonInputScreen +import org.hisp.dhis.common.screens.InputRadioButtonScreen import org.hisp.dhis.common.screens.RadioButtonScreen import org.hisp.dhis.common.screens.SectionScreen import org.hisp.dhis.common.screens.SupportingTextScreen @@ -132,7 +132,7 @@ fun Main() { Components.INPUT_INTEGER -> InputIntegerScreen() Components.INPUT_NUMBER -> InputNumberScreen() Components.INPUT_LETTER -> InputLetterScreen() - Components.RADIO_BUTTON_INPUT -> RadioButtonInputScreen() + Components.INPUT_RADIO_BUTTON -> InputRadioButtonScreen() } } } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt index c31a05ccb..2a0f74e2e 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt @@ -26,5 +26,5 @@ enum class Components(val label: String) { INPUT("Input"), BUTTON_BLOCK("Button block"), ICON_CARDS("Icon Cards"), - RADIO_BUTTON_INPUT("Radio Button Input"), + INPUT_RADIO_BUTTON("Input Radio Button"), } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/RadioButtonInputScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/RadioButtonInputScreen.kt index 6a84d29ca..f66d98689 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/RadioButtonInputScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/RadioButtonInputScreen.kt @@ -12,12 +12,12 @@ import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState import org.hisp.dhis.mobile.ui.designsystem.component.Orientation import org.hisp.dhis.mobile.ui.designsystem.component.RadioButtonData -import org.hisp.dhis.mobile.ui.designsystem.component.RadioButtonInput +import org.hisp.dhis.mobile.ui.designsystem.component.InputRadioButton import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing @Composable -fun RadioButtonInputScreen() { +fun InputRadioButtonScreen() { val option1 = "Option 1" val option2 = "Option 2" val option3 = "Option 3" @@ -69,7 +69,7 @@ fun RadioButtonInputScreen() { } ColumnComponentContainer("Radio Buttons") { SubTitle("Vertical") - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonDataItemsVertical, itemSelected = selectedItemVertical, @@ -78,7 +78,7 @@ fun RadioButtonInputScreen() { }, ) Spacer(Modifier.size(Spacing.Spacing18)) - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonDataItemsError, state = InputShellState.ERROR, @@ -88,7 +88,7 @@ fun RadioButtonInputScreen() { }, ) Spacer(Modifier.size(Spacing.Spacing18)) - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonDataItemsDisabled, state = InputShellState.DISABLED, @@ -98,7 +98,7 @@ fun RadioButtonInputScreen() { ) Spacer(Modifier.size(Spacing.Spacing18)) SubTitle("Horizontal") - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonDataItemsHorizontal, orientation = Orientation.HORIZONTAL, diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/RadioButtonInput.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/RadioButtonInput.kt index 9e64f2a88..e02bb6375 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/RadioButtonInput.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/RadioButtonInput.kt @@ -12,7 +12,7 @@ import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState.UNFOCUSED import org.hisp.dhis.mobile.ui.designsystem.component.Orientation.VERTICAL /** - * DHIS2 Radio Button Input. Wraps DHIS · [RadioButton]. + * DHIS2 Input Radio Button. Wraps DHIS · [RadioButton]. * @param title controls the text to be shown for the title * @param radioButtonData Contains all the data that will be displayed, the list type is RadioButtonData, * It's parameters are uid for identifying the component, selected for controlling which option is selected, @@ -29,7 +29,7 @@ import org.hisp.dhis.mobile.ui.designsystem.component.Orientation.VERTICAL * @param onItemChange is a callback to notify which item has changed into the block. */ @Composable -fun RadioButtonInput( +fun InputRadioButton( title: String, radioButtonData: List, modifier: Modifier = Modifier, diff --git a/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/RadioButtonInputTest.kt b/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputRadioButtonTest.kt similarity index 97% rename from designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/RadioButtonInputTest.kt rename to designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputRadioButtonTest.kt index bdd81a29e..8e8164115 100644 --- a/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/RadioButtonInputTest.kt +++ b/designsystem/src/desktopTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputRadioButtonTest.kt @@ -16,7 +16,7 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor import org.junit.Rule import org.junit.Test -class RadioButtonInputTest { +class InputRadioButtonTest { @get:Rule val rule = createComposeRule() @@ -32,7 +32,7 @@ class RadioButtonInputTest { var selectedItem by remember { mutableStateOf(radioButtonData[0]) } - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, itemSelected = selectedItem, @@ -58,7 +58,7 @@ class RadioButtonInputTest { var selectedItem by remember { mutableStateOf(radioButtonData[0]) } - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, modifier = Modifier.testTag("RADIO_BUTTON_INPUT"), @@ -84,7 +84,7 @@ class RadioButtonInputTest { var selectedItem by remember { mutableStateOf(radioButtonData[0]) } - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, modifier = Modifier.testTag("RADIO_BUTTON_INPUT"), @@ -111,7 +111,7 @@ class RadioButtonInputTest { var selectedItem by remember { mutableStateOf(radioButtonData[0]) } - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, modifier = Modifier.testTag("RADIO_BUTTON_INPUT"), @@ -136,7 +136,7 @@ class RadioButtonInputTest { var selectedItem by remember { mutableStateOf(null) } - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, modifier = Modifier.testTag("RADIO_BUTTON_INPUT"), @@ -160,7 +160,7 @@ class RadioButtonInputTest { var selectedItem by remember { mutableStateOf(radioButtonData[0]) } - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, state = InputShellState.DISABLED, @@ -186,7 +186,7 @@ class RadioButtonInputTest { var selectedItem by remember { mutableStateOf(radioButtonData[0]) } - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, modifier = Modifier.testTag("RADIO_BUTTON_INPUT"), @@ -211,7 +211,7 @@ class RadioButtonInputTest { RadioButtonData("1", selected = false, enabled = true, textInput = "Option 2"), RadioButtonData("2", selected = false, enabled = true, textInput = "Option 3"), ) - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, legendData = LegendData(SurfaceColor.CustomGreen, "Legend"), @@ -232,7 +232,7 @@ class RadioButtonInputTest { RadioButtonData("1", selected = false, enabled = true, textInput = "Option 2"), RadioButtonData("2", selected = false, enabled = true, textInput = "Option 3"), ) - RadioButtonInput( + InputRadioButton( title = "Label", radioButtonData = radioButtonData, supportingText = listOf(SupportingTextData("Supporting text", SupportingTextState.DEFAULT)),