Skip to content

Commit

Permalink
add: [ANDROAPP-5467] component renamed to TimeUnitSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAparicioAlbaAsenjo committed Sep 25, 2023
1 parent 95e490c commit 5e834d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fun Main() {
Components.INPUT_INTEGER -> InputIntegerScreen()
Components.INPUT_NUMBER -> InputNumberScreen()
Components.INPUT_LETTER -> InputLetterScreen()
Components.AGE_FIELD -> AgeFieldScreen()
Components.AGE_FIELD -> InputAgeScreen()
Components.CHIPS -> ChipsScreen()
Components.BADGES -> BadgesScreen()
Components.SWITCH -> SwitchScreen()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import org.hisp.dhis.mobile.ui.designsystem.component.AgeFieldHelper
import org.hisp.dhis.mobile.ui.designsystem.component.AgeFieldHelperValues
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
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.SubTitle
import org.hisp.dhis.mobile.ui.designsystem.component.TimeUnitSelector
import org.hisp.dhis.mobile.ui.designsystem.component.TimeUnitValues

@Composable
fun InputAgeScreen() {
ColumnComponentContainer("Age Field components") {
SubTitle("Horizontal Age Field Helper")
var selectedFieldHorizontal by remember {
mutableStateOf(RadioButtonData("0", selected = true, enabled = true, textInput = AgeFieldHelperValues.YEARS.value))
mutableStateOf(RadioButtonData("0", selected = true, enabled = true, textInput = TimeUnitValues.YEARS.value))
}
AgeFieldHelper(Orientation.HORIZONTAL, AgeFieldHelperValues.YEARS.value) {
TimeUnitSelector(Orientation.HORIZONTAL, TimeUnitValues.YEARS.value) {
selectedFieldHorizontal = it
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
* @param onClick is a callback to notify which item has changed into the block.
*/
@Composable
fun AgeFieldHelper(
fun TimeUnitSelector(
orientation: Orientation,
optionSelected: String,
onClick: (RadioButtonData) -> Unit,
Expand All @@ -31,7 +31,7 @@ fun AgeFieldHelper(
)
.background(color = SurfaceColor.Surface, Shape.SmallBottom),
) {
val options = AgeFieldHelperValues.values().map {
val options = TimeUnitValues.values().map {
RadioButtonData(it.value, optionSelected == it.value, true, provideStringResource(it.value))
}
val selectedItem = options.find {
Expand All @@ -43,8 +43,8 @@ fun AgeFieldHelper(
}
}

enum class AgeFieldHelperValues(val value: String) {
YEARS("Years"),
MONTHS("Months"),
DAYS("Days"),
enum class TimeUnitValues(val value: String) {
YEARS("years"),
MONTHS("months"),
DAYS("days"),
}

0 comments on commit 5e834d0

Please sign in to comment.