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:
committed by
GitHub
parent
3cf121345a
commit
f4c73477c7
@@ -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 = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user