diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt index b440bc785..31dff263c 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsContained.kt @@ -86,7 +86,11 @@ fun ButtonsContained(customizationState: ButtonCustomizationState) { parameters = { simple("style", buttonStyle.value.fullName) if (hasFullScreenWidth) fillMaxWidth() - if (hasLeadingIcon) icon() + if (hasLeadingIcon) { + classInstance("icon", OdsButtonIcon::class.java) { + painter() + } + } if (!isEnabled) enabled(false) } ) diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt index b346c4337..8197bda6c 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsOutlined.kt @@ -62,7 +62,11 @@ fun ButtonsOutlined(customizationState: ButtonCustomizationState) { exhaustiveParameters = false, parameters = { if (hasFullScreenWidth) fillMaxWidth() - if (hasLeadingIcon) icon() + if (hasLeadingIcon) { + classInstance("icon", OdsButtonIcon::class.java) { + painter() + } + } if (!isEnabled) enabled(false) }) } diff --git a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt index d0ee0d5dd..1b9ab8f15 100644 --- a/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt +++ b/app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonsText.kt @@ -81,7 +81,11 @@ fun ButtonsText(customizationState: ButtonCustomizationState) { parameters = { simple("style", textButtonStyle.value.fullName) if (hasFullScreenWidth) fillMaxWidth() - if (hasLeadingIcon) icon() + if (hasLeadingIcon) { + classInstance("icon", OdsButtonIcon::class.java) { + painter() + } + } if (!isEnabled) enabled(false) } ) diff --git a/docs/components/Buttons.md b/docs/components/Buttons.md index e965559b3..269a6776a 100644 --- a/docs/components/Buttons.md +++ b/docs/components/Buttons.md @@ -54,7 +54,7 @@ OdsTextButton( text = "Text button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee), // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)), // Optional, line can be removed if you don't need any icon style = OdsTextButtonStyle.Primary ) ``` @@ -98,7 +98,7 @@ OdsOutlinedButton( text = "Outlined button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee) // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)) // Optional, line can be removed if you don't need any icon ) ``` @@ -149,7 +149,7 @@ OdsButton( text = "Contained button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee) // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)) // Optional, line can be removed if you don't need any icon ) ``` @@ -161,7 +161,7 @@ OdsButton( text = "Positive button", onClick = {}, enabled = true, - icon = painterResource(R.drawable.ic_coffee), // Optional, line can be removed if you don't need any icon + icon = OdsButtonIcon(painterResource(R.drawable.ic_coffee)), // Optional, line can be removed if you don't need any icon style = OdsButtonStyle.FunctionalPositive ) ```