File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -437,6 +437,9 @@ const App: React.FC = () => {
437437 consequences = { state . confirmDialog . consequences }
438438 confirmLabel = { state . confirmDialog . confirmLabel }
439439 onConfirm = { state . executeConfirmDialog }
440+ secondaryActionLabel = { state . confirmDialog . secondaryActionLabel }
441+ secondaryActionVariant = { state . confirmDialog . secondaryActionVariant }
442+ onSecondaryAction = { state . executeConfirmDialogSecondary }
440443 onCancel = { state . closeConfirmDialog }
441444 />
442445 ) }
@@ -451,6 +454,9 @@ const App: React.FC = () => {
451454 consequences = { state . confirmDialog . consequences }
452455 confirmLabel = { state . confirmDialog . confirmLabel }
453456 onConfirm = { state . executeConfirmDialog }
457+ secondaryActionLabel = { state . confirmDialog . secondaryActionLabel }
458+ secondaryActionVariant = { state . confirmDialog . secondaryActionVariant }
459+ onSecondaryAction = { state . executeConfirmDialogSecondary }
454460 onCancel = { state . closeConfirmDialog }
455461 />
456462 ) }
Original file line number Diff line number Diff line change @@ -15,10 +15,13 @@ interface ConfirmProps {
1515 irreversible ?: boolean ;
1616 consequences ?: string ;
1717 confirmLabel ?: string ;
18+ secondaryActionLabel ?: string ;
1819 cancelLabel ?: string ;
1920 onConfirm : ( ) => void ;
21+ onSecondaryAction ?: ( ) => void ;
2022 onCancel : ( ) => void ;
2123 confirmVariant ?: 'default' | 'danger' ;
24+ secondaryActionVariant ?: 'default' | 'danger' ;
2225}
2326
2427export const Confirm : React . FC < ConfirmProps > = ( {
@@ -29,10 +32,13 @@ export const Confirm: React.FC<ConfirmProps> = ({
2932 irreversible = false ,
3033 consequences,
3134 confirmLabel,
35+ secondaryActionLabel,
3236 cancelLabel,
3337 onConfirm,
38+ onSecondaryAction,
3439 onCancel,
3540 confirmVariant = 'default' ,
41+ secondaryActionVariant = 'default' ,
3642} ) => {
3743 const { tr } = useI18n ( ) ;
3844
@@ -44,8 +50,11 @@ export const Confirm: React.FC<ConfirmProps> = ({
4450 onConfirm = { onConfirm }
4551 onEnter = { onConfirm }
4652 confirmLabel = { confirmLabel ?? tr ( 'Fortfahren' , 'Continue' ) }
53+ secondaryActionLabel = { secondaryActionLabel }
4754 cancelLabel = { cancelLabel ?? tr ( 'Abbrechen' , 'Cancel' ) }
4855 confirmVariant = { confirmVariant }
56+ secondaryActionVariant = { secondaryActionVariant }
57+ onSecondaryAction = { onSecondaryAction }
4958 >
5059 < p className = "dialog-message" > { message } </ p >
5160 { contextItems . length > 0 && (
Original file line number Diff line number Diff line change @@ -10,9 +10,12 @@ interface DangerConfirmProps {
1010 irreversible ?: boolean ;
1111 consequences ?: string ;
1212 confirmLabel ?: string ;
13+ secondaryActionLabel ?: string ;
1314 cancelLabel ?: string ;
1415 onConfirm : ( ) => void ;
16+ onSecondaryAction ?: ( ) => void ;
1517 onCancel : ( ) => void ;
18+ secondaryActionVariant ?: 'default' | 'danger' ;
1619}
1720
1821export const DangerConfirm : React . FC < DangerConfirmProps > = ( {
@@ -23,9 +26,12 @@ export const DangerConfirm: React.FC<DangerConfirmProps> = ({
2326 irreversible = true ,
2427 consequences,
2528 confirmLabel,
29+ secondaryActionLabel,
2630 cancelLabel,
2731 onConfirm,
32+ onSecondaryAction,
2833 onCancel,
34+ secondaryActionVariant = 'default' ,
2935} ) => {
3036 const { tr } = useI18n ( ) ;
3137
@@ -38,10 +44,13 @@ export const DangerConfirm: React.FC<DangerConfirmProps> = ({
3844 irreversible = { irreversible }
3945 consequences = { consequences }
4046 confirmLabel = { confirmLabel ?? tr ( 'Trotzdem ausführen' , 'Run anyway' ) }
47+ secondaryActionLabel = { secondaryActionLabel }
4148 cancelLabel = { cancelLabel }
4249 onConfirm = { onConfirm }
50+ onSecondaryAction = { onSecondaryAction }
4351 onCancel = { onCancel }
4452 confirmVariant = "danger"
53+ secondaryActionVariant = { secondaryActionVariant }
4554 />
4655 ) ;
4756} ;
Original file line number Diff line number Diff line change @@ -7,11 +7,14 @@ interface DialogFrameProps {
77 title : string ;
88 onClose : ( ) => void ;
99 onConfirm ?: ( ) => void ;
10+ onSecondaryAction ?: ( ) => void ;
1011 onEnter ?: ( ) => void ;
1112 confirmLabel ?: string ;
13+ secondaryActionLabel ?: string ;
1214 cancelLabel ?: string ;
1315 confirmDisabled ?: boolean ;
1416 confirmVariant ?: 'default' | 'danger' ;
17+ secondaryActionVariant ?: 'default' | 'danger' ;
1518 closeOnBackdrop ?: boolean ;
1619 initialFocusRef ?: React . RefObject < HTMLElement | null > ;
1720 children : React . ReactNode ;
@@ -31,11 +34,14 @@ export const DialogFrame: React.FC<DialogFrameProps> = ({
3134 title,
3235 onClose,
3336 onConfirm,
37+ onSecondaryAction,
3438 onEnter,
3539 confirmLabel,
40+ secondaryActionLabel,
3641 cancelLabel,
3742 confirmDisabled = false ,
3843 confirmVariant = 'default' ,
44+ secondaryActionVariant = 'default' ,
3945 closeOnBackdrop = true ,
4046 initialFocusRef,
4147 children,
@@ -134,6 +140,14 @@ export const DialogFrame: React.FC<DialogFrameProps> = ({
134140 < button className = "dialog-btn dialog-btn-secondary" onClick = { onClose } >
135141 { cancelLabel ?? tr ( 'Abbrechen' , 'Cancel' ) }
136142 </ button >
143+ { onSecondaryAction && (
144+ < button
145+ className = { `dialog-btn ${ secondaryActionVariant === 'danger' ? 'dialog-btn-danger' : 'dialog-btn-primary' } ` }
146+ onClick = { onSecondaryAction }
147+ >
148+ { secondaryActionLabel ?? tr ( 'Alternative ausfuehren' , 'Run alternative' ) }
149+ </ button >
150+ ) }
137151 { onConfirm && (
138152 < button
139153 className = { `dialog-btn ${ confirmVariant === 'danger' ? 'dialog-btn-danger' : 'dialog-btn-primary' } ` }
You can’t perform that action at this time.
0 commit comments