-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathDialogContent.tsx
77 lines (63 loc) · 2.51 KB
/
DialogContent.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import classNames from "classnames";
import { createElement, Fragment, PropsWithChildren, ReactElement } from "react";
interface PropsWithChildrenWithClass extends PropsWithChildren {
className?: string;
}
export function DialogContent(props: PropsWithChildrenWithClass): ReactElement {
const { children, className } = props;
return (
<div className={classNames("widget-rich-text-modal-body modal-dialog mx-window mx-window-active", className)}>
<div className="modal-content mx-window-content">{children}</div>
</div>
);
}
export interface DialogHeaderProps extends PropsWithChildrenWithClass {
onClose(): void;
}
export function DialogHeader(props: DialogHeaderProps): ReactElement {
const { children, onClose, className } = props;
return (
<Fragment>
<div className={classNames("widget-rich-text-modal-header modal-header", className)}>
<button type="button" className="close" title="close" aria-label="close" onClick={onClose}>
×
</button>
<h4>{children}</h4>
</div>
<div className="hide">{children}</div>
</Fragment>
);
}
export function DialogBody(props: PropsWithChildrenWithClass): ReactElement {
const { children, className } = props;
return <div className={classNames("widget-rich-text-modal-content form-horizontal", className)}>{children}</div>;
}
export interface FormControlProps extends PropsWithChildrenWithClass {
label?: string;
}
export function FormControl(props: FormControlProps): ReactElement {
const { children, className, label } = props;
return (
<div className={classNames("form-group", className)}>
{label && <label className="control-label col-sm-3">{label}</label>}
<div className={`col-sm-${label ? "9" : "12"}`}> {children}</div>
</div>
);
}
export interface DialogFooterProps extends PropsWithChildrenWithClass {
onClose(): void;
onSubmit(...args: any[]): void;
}
export function DialogFooter(props: DialogFooterProps): ReactElement {
const { onSubmit, onClose, className } = props;
return (
<div className={classNames("mx-dataview-controls", className)}>
<button type="button" className="btn mx-button btn-success" onClick={onSubmit}>
Save
</button>
<button type="button" className="btn mx-button btn-default" onClick={onClose}>
Cancel
</button>
</div>
);
}