Skip to content

Commit

Permalink
fix: Update delete account button on ManageAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
omerhabib26 committed Sep 3, 2024
1 parent 3896cba commit 3a2b767
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
19 changes: 12 additions & 7 deletions core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
}
}
Expand Down

0 comments on commit 3a2b767

Please sign in to comment.