Skip to content

Commit

Permalink
[#395] Use Enabled parameter in customization bottom sheets to be con…
Browse files Browse the repository at this point in the history
…sistent with the code implementation
  • Loading branch information
paulinea authored and florentmaitre committed Jan 16, 2023
1 parent cedf678 commit ae669d4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ fun rememberButtonCustomizationState(
textButtonStyle: MutableState<OdsTextButtonStyle> = rememberSaveable { mutableStateOf(OdsTextButtonStyle.Default) },
leadingIcon: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) },
variableWidth: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) },
disabled: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) }
enabled: MutableState<Boolean> = rememberSaveable { mutableStateOf(true) }
) =
remember(containedButtonStyle, textButtonStyle, leadingIcon, variableWidth, disabled) {
ButtonCustomizationState(containedButtonStyle, textButtonStyle, leadingIcon, variableWidth, disabled)
remember(containedButtonStyle, textButtonStyle, leadingIcon, variableWidth, enabled) {
ButtonCustomizationState(containedButtonStyle, textButtonStyle, leadingIcon, variableWidth, enabled)
}

@Composable
Expand All @@ -44,14 +44,14 @@ class ButtonCustomizationState(
val textButtonStyle: MutableState<OdsTextButtonStyle>,
val leadingIcon: MutableState<Boolean>,
val variableWidth: MutableState<Boolean>,
val disabled: MutableState<Boolean>
val enabled: MutableState<Boolean>
) {

val hasLeadingIcon
get() = leadingIcon.value

val isEnabled
get() = !disabled.value
get() = enabled.value

val hasVariableWidth
get() = variableWidth.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ fun ButtonsContained(style: OdsButtonStyle) {
trailing = OdsSwitchTrailing(checked = variableWidth)
)
OdsListItem(
text = stringResource(id = R.string.component_state_disabled),
trailing = OdsSwitchTrailing(checked = disabled)
text = stringResource(id = R.string.component_state_enabled),
trailing = OdsSwitchTrailing(checked = enabled)
)
}) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ fun ButtonsIcon() {
bottomSheetScaffoldState = rememberBottomSheetScaffoldState(),
bottomSheetContent = {
OdsListItem(
text = stringResource(id = R.string.component_state_disabled),
trailing = OdsSwitchTrailing(checked = disabled)
text = stringResource(id = R.string.component_state_enabled),
trailing = OdsSwitchTrailing(checked = enabled)
)
}) {
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ fun ButtonsOutlined() {
trailing = OdsSwitchTrailing(checked = variableWidth)
)
OdsListItem(
text = stringResource(id = R.string.component_state_disabled),
trailing = OdsSwitchTrailing(checked = disabled)
text = stringResource(id = R.string.component_state_enabled),
trailing = OdsSwitchTrailing(checked = enabled)
)
}) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ fun ButtonsText() {
trailing = OdsSwitchTrailing(checked = variableWidth)
)
OdsListItem(
text = stringResource(id = R.string.component_state_disabled),
trailing = OdsSwitchTrailing(checked = disabled)
text = stringResource(id = R.string.component_state_enabled),
trailing = OdsSwitchTrailing(checked = enabled)
)
}) {

Expand Down

0 comments on commit ae669d4

Please sign in to comment.