File tree Expand file tree Collapse file tree 4 files changed +20
-0
lines changed
packages/application-components/src/components/dialogs Expand file tree Collapse file tree 4 files changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @commercetools-frontend/application-components ' : minor
3
+ ---
4
+
5
+ Pass a new prop ` iconLeftPrimaryButton ` , to provide an icon to the left in the primary button of the form dialog.
Original file line number Diff line number Diff line change @@ -54,6 +54,17 @@ describe('rendering', () => {
54
54
} ,
55
55
} ) ) ;
56
56
57
+ it ( 'should show primaryButton Icon' , ( ) =>
58
+ validateComponent ( {
59
+ title : 'Lorem ipsus' ,
60
+ extraProps : {
61
+ iconLeftPrimaryButton : < div > button icon</ div > ,
62
+ } ,
63
+ extraChecks : ( ) => {
64
+ screen . getByText ( 'button icon' ) ;
65
+ } ,
66
+ } ) ) ;
67
+
57
68
it ( 'should show additional content in footer' , ( ) =>
58
69
validateComponent ( {
59
70
title : 'Lorem ipsus' ,
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export type TFormDialogProps = {
31
31
dataAttributesPrimaryButton ?: { [ key : string ] : string } ;
32
32
getParentSelector ?: ( ) => HTMLElement ;
33
33
iconLeftSecondaryButton ?: ReactElement ;
34
+ iconLeftPrimaryButton ?: ReactElement ;
34
35
footerContent ?: ReactNode ;
35
36
} ;
36
37
@@ -59,6 +60,7 @@ const FormDialog = ({
59
60
dataAttributesSecondaryButton = { props . dataAttributesSecondaryButton }
60
61
dataAttributesPrimaryButton = { props . dataAttributesPrimaryButton }
61
62
iconLeftSecondaryButton = { props . iconLeftSecondaryButton }
63
+ iconLeftPrimaryButton = { props . iconLeftPrimaryButton }
62
64
footerContent = { props . footerContent }
63
65
/>
64
66
</ DialogContainer >
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ type Props = {
26
26
dataAttributesSecondaryButton ?: { [ key : string ] : string } ;
27
27
children ?: never ;
28
28
iconLeftSecondaryButton ?: ReactElement ;
29
+ iconLeftPrimaryButton ?: ReactElement ;
29
30
footerContent ?: ReactNode ;
30
31
} ;
31
32
@@ -60,6 +61,7 @@ const DialogFooter = ({
60
61
/>
61
62
< PrimaryButton
62
63
label = { getFormattedLabel ( props . labelPrimary , intl ) }
64
+ iconLeft = { props . iconLeftPrimaryButton }
63
65
onClick = { props . onConfirm }
64
66
isDisabled = { isPrimaryButtonDisabled }
65
67
{ ...filterDataAttributes ( dataAttributesPrimaryButton ) }
You can’t perform that action at this time.
0 commit comments