Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

613 - Apply new API in buttons code implementation #614

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
)
Expand Down
8 changes: 4 additions & 4 deletions docs/components/Buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
```
Expand Down Expand Up @@ -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
)
```

Expand Down Expand Up @@ -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
)
```

Expand All @@ -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
)
```
Expand Down