Skip to content

Commit b8db02e

Browse files
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 <[email protected]>
1 parent 23cb084 commit b8db02e

File tree

80 files changed

+201
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+201
-155
lines changed

libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/AlertDialogContent.kt

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ internal fun SimpleAlertDialogContent(
142142
Text(
143143
text = titleText,
144144
style = ElementTheme.typography.fontHeadingSmMedium,
145-
textAlign = TextAlign.Center,
145+
textAlign = if (icon != null) TextAlign.Center else TextAlign.Start,
146146
)
147147
}
148148
},
@@ -510,3 +510,43 @@ internal fun DialogWithThirdButtonPreview() {
510510
}
511511
}
512512
}
513+
514+
@Preview(group = PreviewGroup.Dialogs, name = "Dialog with a very long title")
515+
@Composable
516+
@Suppress("MaxLineLength")
517+
internal fun DialogWithVeryLongTitlePreview() {
518+
ElementThemedPreview(showBackground = false) {
519+
DialogPreview {
520+
SimpleAlertDialogContent(
521+
title = "Dialog Title that takes more than one line",
522+
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
523+
" or prompt for a decision to be made. Learn more",
524+
submitText = "OK",
525+
onSubmitClick = {},
526+
)
527+
}
528+
}
529+
}
530+
531+
@Preview(group = PreviewGroup.Dialogs, name = "Dialog with a very long title and icon")
532+
@Composable
533+
@Suppress("MaxLineLength")
534+
internal fun DialogWithVeryLongTitleAndIconPreview() {
535+
ElementThemedPreview(showBackground = false) {
536+
DialogPreview {
537+
SimpleAlertDialogContent(
538+
icon = {
539+
Icon(
540+
imageVector = CompoundIcons.NotificationsSolid(),
541+
contentDescription = null
542+
)
543+
},
544+
title = "Dialog Title that takes more than one line",
545+
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
546+
" or prompt for a decision to be made. Learn more",
547+
submitText = "OK",
548+
onSubmitClick = {},
549+
)
550+
}
551+
}
552+
}
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)