diff --git a/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt b/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt index e1880a36e..cbb324f70 100644 --- a/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt +++ b/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt @@ -1192,10 +1192,11 @@ fun OutlinePrimaryButton( @SuppressLint("ModifierParameter") fun TertiaryButton( modifier: Modifier = Modifier.wrapContentSize(), - text: String, + text: String = "", onClick: () -> Unit, enabled: Boolean = true, textColor: Color = MaterialTheme.appColors.textPrimary, + content: (@Composable RowScope.() -> Unit)? = null, ) { Button( modifier = Modifier @@ -1211,12 +1212,16 @@ fun TertiaryButton( enabled = enabled, onClick = onClick, ) { - Text( - modifier = Modifier.testTag("txt_${text.tagId()}"), - text = text, - style = MaterialTheme.appTypography.labelLarge, - color = textColor.copy(alpha = if (enabled) 1f else 0.3f) - ) + if (content == null) { + Text( + modifier = Modifier.testTag("txt_${text.tagId()}"), + text = text, + style = MaterialTheme.appTypography.labelLarge, + color = textColor.copy(alpha = if (enabled) 1f else 0.3f) + ) + } else { + content() + } } } diff --git a/profile/src/main/java/org/openedx/profile/presentation/manageaccount/compose/ManageAccountView.kt b/profile/src/main/java/org/openedx/profile/presentation/manageaccount/compose/ManageAccountView.kt index bccfb4c28..678f67d8c 100644 --- a/profile/src/main/java/org/openedx/profile/presentation/manageaccount/compose/ManageAccountView.kt +++ b/profile/src/main/java/org/openedx/profile/presentation/manageaccount/compose/ManageAccountView.kt @@ -42,6 +42,7 @@ import org.openedx.core.UIMessage import org.openedx.core.ui.HandleUIMessage import org.openedx.core.ui.IconText import org.openedx.core.ui.OutlinePrimaryButton +import org.openedx.core.ui.TertiaryButton import org.openedx.core.ui.Toolbar import org.openedx.core.ui.WindowSize import org.openedx.core.ui.WindowType @@ -173,14 +174,18 @@ internal fun ManageAccountView( onAction(ManageAccountViewAction.EditAccountClick) }, ) - IconText( - text = stringResource(id = ProfileR.string.profile_delete_profile), - painter = painterResource(id = ProfileR.drawable.profile_ic_trash), - textStyle = MaterialTheme.appTypography.labelLarge, - color = MaterialTheme.appColors.error, - onClick = { - onAction(ManageAccountViewAction.DeleteAccount) - }) + TertiaryButton( + onClick = { onAction(ManageAccountViewAction.DeleteAccount) }, + content = { + IconText( + text = stringResource(id = ProfileR.string.profile_delete_profile), + painter = painterResource(id = ProfileR.drawable.profile_ic_trash), + textStyle = MaterialTheme.appTypography.labelLarge, + color = MaterialTheme.appColors.error, + ) + } + ) + Spacer(modifier = Modifier.height(12.dp)) } } }