Do not center the dialog title text for dialogs with no icon (#5332)
* Fix: do not center the dialog title text for dialogs with no icon * Fix alignment for dialogs with icons, add screenshots * Replace text title in previews so the screenshot tests are easier to understand * Update screenshots --------- Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
23cb084126
commit
b8db02e4ac
80 changed files with 201 additions and 155 deletions
|
|
@ -142,7 +142,7 @@ internal fun SimpleAlertDialogContent(
|
|||
Text(
|
||||
text = titleText,
|
||||
style = ElementTheme.typography.fontHeadingSmMedium,
|
||||
textAlign = TextAlign.Center,
|
||||
textAlign = if (icon != null) TextAlign.Center else TextAlign.Start,
|
||||
)
|
||||
}
|
||||
},
|
||||
|
|
@ -510,3 +510,43 @@ internal fun DialogWithThirdButtonPreview() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(group = PreviewGroup.Dialogs, name = "Dialog with a very long title")
|
||||
@Composable
|
||||
@Suppress("MaxLineLength")
|
||||
internal fun DialogWithVeryLongTitlePreview() {
|
||||
ElementThemedPreview(showBackground = false) {
|
||||
DialogPreview {
|
||||
SimpleAlertDialogContent(
|
||||
title = "Dialog Title that takes more than one line",
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(group = PreviewGroup.Dialogs, name = "Dialog with a very long title and icon")
|
||||
@Composable
|
||||
@Suppress("MaxLineLength")
|
||||
internal fun DialogWithVeryLongTitleAndIconPreview() {
|
||||
ElementThemedPreview(showBackground = false) {
|
||||
DialogPreview {
|
||||
SimpleAlertDialogContent(
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.NotificationsSolid(),
|
||||
contentDescription = null
|
||||
)
|
||||
},
|
||||
title = "Dialog Title that takes more than one line",
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue