|
1 | 1 | import * as React from 'react';
|
2 |
| -import { classNames, getBEMElement, getBEMModifier, prefixClaName } from 'mo/common/className'; |
| 2 | +import { |
| 3 | + classNames, |
| 4 | + getBEMElement, |
| 5 | + getBEMModifier, |
| 6 | + prefixClaName, |
| 7 | +} from 'mo/common/className'; |
3 | 8 | import Dialog, { IModalFuncProps } from './modal';
|
4 | 9 | import ActionButton from './actionButton';
|
5 | 10 |
|
@@ -42,28 +47,31 @@ const ConfirmDialog = (props: ConfirmDialogProps) => {
|
42 | 47 | maskTransitionName = 'fade',
|
43 | 48 | } = props;
|
44 | 49 |
|
45 |
| - const confirmDescriperClassName = getBEMElement(confirmClassName, `${props.type}`) |
| 50 | + const confirmDescriperClassName = getBEMElement( |
| 51 | + confirmClassName, |
| 52 | + `${props.type}` |
| 53 | + ); |
46 | 54 | const containerClassName = getBEMElement(confirmClassName, 'container');
|
47 | 55 | const indicatorClassName = getBEMElement(confirmClassName, 'indicator');
|
48 |
| - const contentClassName = getBEMElement(confirmClassName, 'content'); |
49 |
| - const messageClassName = getBEMElement(confirmClassName, 'message'); |
| 56 | + const contentClassName = getBEMElement(confirmClassName, 'content'); |
| 57 | + const messageClassName = getBEMElement(confirmClassName, 'message'); |
50 | 58 | const btnsClassName = getBEMElement(confirmClassName, 'btns');
|
51 | 59 |
|
52 | 60 | const classString = classNames(
|
53 | 61 | confirmClassName,
|
54 | 62 | confirmDescriperClassName,
|
55 |
| - className, |
| 63 | + className |
56 | 64 | );
|
57 | 65 |
|
58 | 66 | const cancelButton = okCancel && (
|
59 | 67 | <ActionButton
|
60 |
| - actionFn={onCancel} |
61 |
| - closeModal={close} |
62 |
| - buttonProps={cancelButtonProps} |
| 68 | + actionFn={onCancel} |
| 69 | + closeModal={close} |
| 70 | + buttonProps={cancelButtonProps} |
63 | 71 | >
|
64 |
| - {cancelText} |
| 72 | + {cancelText} |
65 | 73 | </ActionButton>
|
66 |
| - ); |
| 74 | + ); |
67 | 75 |
|
68 | 76 | return (
|
69 | 77 | <Dialog
|
@@ -96,31 +104,42 @@ const ConfirmDialog = (props: ConfirmDialogProps) => {
|
96 | 104 | <div className={indicatorClassName}> {icon} </div>
|
97 | 105 | <div className={messageClassName}>
|
98 | 106 | {props.title !== undefined && (
|
99 |
| - <span className={getBEMModifier(messageClassName, 'text')}> |
| 107 | + <span |
| 108 | + className={getBEMModifier( |
| 109 | + messageClassName, |
| 110 | + 'text' |
| 111 | + )} |
| 112 | + > |
100 | 113 | {props.title}
|
101 | 114 | </span>
|
102 | 115 | )}
|
103 |
| - <div className={`${getBEMModifier(messageClassName, 'detail')}`}> |
| 116 | + <div |
| 117 | + className={`${getBEMModifier( |
| 118 | + messageClassName, |
| 119 | + 'detail' |
| 120 | + )}`} |
| 121 | + > |
104 | 122 | {props.content}
|
105 | 123 | </div>
|
106 | 124 | </div>
|
107 | 125 | </div>
|
108 | 126 | <div className={btnsClassName}>
|
109 |
| - { |
110 |
| - actions === undefined ? ( |
| 127 | + {actions === undefined ? ( |
111 | 128 | <>
|
112 | 129 | {cancelButton}
|
113 |
| - {<ActionButton |
114 |
| - actionFn={onOk} |
115 |
| - closeModal={close} |
116 |
| - buttonProps={okButtonProps} |
117 |
| - > |
118 |
| - {okText} |
119 |
| - </ActionButton> |
120 |
| - } |
| 130 | + { |
| 131 | + <ActionButton |
| 132 | + actionFn={onOk} |
| 133 | + closeModal={close} |
| 134 | + buttonProps={okButtonProps} |
| 135 | + > |
| 136 | + {okText} |
| 137 | + </ActionButton> |
| 138 | + } |
121 | 139 | </>
|
122 |
| - ) : actions |
123 |
| - } |
| 140 | + ) : ( |
| 141 | + actions |
| 142 | + )} |
124 | 143 | </div>
|
125 | 144 | </div>
|
126 | 145 | </Dialog>
|
|
0 commit comments