Skip to content

Commit c36df38

Browse files
authored
fix(MessageBox): correctly align items in footer and fix header alignment in Safari (#643)
1 parent 0c210a3 commit c36df38

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

packages/main/src/components/MessageBox/MessageBox.jss.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { CssSizeVariables } from '@ui5/webcomponents-react-base/lib/CssSizeVaria
22
import { ThemingParameters } from '@ui5/webcomponents-react-base/lib/ThemingParameters';
33

44
const style = {
5+
messageBox: {
6+
'--sapContent_Shadow0': 'none'
7+
},
58
header: {
69
display: 'flex',
710
height: CssSizeVariables.sapWcrBarHeight,
8-
lineHeight: CssSizeVariables.sapWcrBarHeight,
911
textAlign: 'center',
10-
width: 'auto',
12+
width: '100%',
1113
alignItems: 'center',
1214
padding: '0.25rem 1rem',
1315
boxSizing: 'border-box',
@@ -55,6 +57,7 @@ const style = {
5557
},
5658
footer: {
5759
height: CssSizeVariables.sapWcrBarHeight,
60+
width: '100%',
5861
display: 'flex',
5962
alignItems: 'center',
6063
justifyContent: 'flex-end',

packages/main/src/components/MessageBox/__snapshots__/MessageBox.test.tsx.snap

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
exports[`MessageBox Confirm - Cancel 1`] = `
44
<DocumentFragment>
55
<ui5-dialog
6+
class="MessageBox-messageBox"
67
opened=""
78
style="z-index: 104; display: block;"
89
>
@@ -49,6 +50,7 @@ exports[`MessageBox Confirm - Cancel 1`] = `
4950
exports[`MessageBox Confirm - OK 1`] = `
5051
<DocumentFragment>
5152
<ui5-dialog
53+
class="MessageBox-messageBox"
5254
opened=""
5355
style="z-index: 102; display: block;"
5456
>
@@ -94,7 +96,9 @@ exports[`MessageBox Confirm - OK 1`] = `
9496

9597
exports[`MessageBox Custom Action Text 1`] = `
9698
<DocumentFragment>
97-
<ui5-dialog>
99+
<ui5-dialog
100+
class="MessageBox-messageBox"
101+
>
98102
<footer
99103
class="MessageBox-footer"
100104
slot="footer"
@@ -138,6 +142,7 @@ exports[`MessageBox Custom Action Text 1`] = `
138142
exports[`MessageBox Error 1`] = `
139143
<DocumentFragment>
140144
<ui5-dialog
145+
class="MessageBox-messageBox"
141146
opened=""
142147
style="z-index: 110; display: block;"
143148
>
@@ -178,6 +183,7 @@ exports[`MessageBox Error 1`] = `
178183
exports[`MessageBox Information 1`] = `
179184
<DocumentFragment>
180185
<ui5-dialog
186+
class="MessageBox-messageBox"
181187
opened=""
182188
style="z-index: 112; display: block;"
183189
>
@@ -218,6 +224,7 @@ exports[`MessageBox Information 1`] = `
218224
exports[`MessageBox No Title 1`] = `
219225
<DocumentFragment>
220226
<ui5-dialog
227+
class="MessageBox-messageBox"
221228
opened=""
222229
style="z-index: 118; display: block;"
223230
>
@@ -263,7 +270,9 @@ exports[`MessageBox No Title 1`] = `
263270

264271
exports[`MessageBox Not open 1`] = `
265272
<DocumentFragment>
266-
<ui5-dialog>
273+
<ui5-dialog
274+
class="MessageBox-messageBox"
275+
>
267276
<footer
268277
class="MessageBox-footer"
269278
slot="footer"
@@ -301,6 +310,7 @@ exports[`MessageBox Not open 1`] = `
301310
exports[`MessageBox Show 1`] = `
302311
<DocumentFragment>
303312
<ui5-dialog
313+
class="MessageBox-messageBox"
304314
opened=""
305315
style="z-index: 114; display: block;"
306316
>
@@ -347,6 +357,7 @@ exports[`MessageBox Show 1`] = `
347357
exports[`MessageBox Success 1`] = `
348358
<DocumentFragment>
349359
<ui5-dialog
360+
class="MessageBox-messageBox"
350361
opened=""
351362
style="z-index: 106; display: block;"
352363
>
@@ -387,6 +398,7 @@ exports[`MessageBox Success 1`] = `
387398
exports[`MessageBox Success w/ custom title 1`] = `
388399
<DocumentFragment>
389400
<ui5-dialog
401+
class="MessageBox-messageBox"
390402
opened=""
391403
style="z-index: 116; display: block;"
392404
>
@@ -427,6 +439,7 @@ exports[`MessageBox Success w/ custom title 1`] = `
427439
exports[`MessageBox Warning 1`] = `
428440
<DocumentFragment>
429441
<ui5-dialog
442+
class="MessageBox-messageBox"
430443
opened=""
431444
style="z-index: 108; display: block;"
432445
>

packages/main/src/components/MessageBox/index.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,25 @@ import '@ui5/webcomponents-icons/dist/icons/message-warning';
66
import '@ui5/webcomponents-icons/dist/icons/question-mark';
77
import { createComponentStyles } from '@ui5/webcomponents-react-base/lib/createComponentStyles';
88
import { useConsolidatedRef, useI18nText, usePassThroughHtmlProps } from '@ui5/webcomponents-react-base/lib/hooks';
9+
import { StyleClassHelper } from '@ui5/webcomponents-react-base/lib/StyleClassHelper';
910
import { enrichEventWithDetails } from '@ui5/webcomponents-react-base/lib/Utils';
1011

1112
import {
12-
CONFIRMATION,
13-
ERROR,
14-
HIGHLIGHT,
15-
INFORMATION,
1613
ABORT,
1714
CANCEL,
1815
CLOSE,
16+
CONFIRMATION,
1917
DELETE,
18+
ERROR,
19+
HIGHLIGHT,
2020
IGNORE,
21+
INFORMATION,
2122
NO,
2223
OK,
2324
RETRY,
24-
YES,
2525
SUCCESS,
26-
WARNING
26+
WARNING,
27+
YES
2728
} from '@ui5/webcomponents-react/dist/assets/i18n/i18n-defaults';
2829
import { Button } from '@ui5/webcomponents-react/lib/Button';
2930
import { ButtonDesign } from '@ui5/webcomponents-react/lib/ButtonDesign';
@@ -175,13 +176,15 @@ const MessageBox: FC<MessageBoxPropTypes> = forwardRef((props: MessageBoxPropTyp
175176

176177
const passThroughProps = usePassThroughHtmlProps(props, ['onClose']);
177178

179+
const messageBoxClassNames = StyleClassHelper.of(classes.messageBox).putIfPresent(className).className;
180+
178181
return (
179182
<Dialog
180183
slot={slot}
181184
ref={dialogRef}
182185
style={style}
183186
tooltip={tooltip}
184-
className={className}
187+
className={messageBoxClassNames}
185188
header={
186189
<header className={classes.header} data-type={type}>
187190
{iconToRender}

0 commit comments

Comments
 (0)