-
Notifications
You must be signed in to change notification settings - Fork 195
Expand file tree
/
Copy pathindex.tsx
More file actions
83 lines (78 loc) · 1.89 KB
/
index.tsx
File metadata and controls
83 lines (78 loc) · 1.89 KB
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
78
79
80
81
82
83
import React from 'react';
import {
ActionRow,
ModalDialog,
Scrollable,
} from '@openedx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import messages from './messages';
interface BaseModalProps {
isOpen: boolean;
close: () => void;
title: string;
children: React.ReactNode;
confirmAction: React.ReactNode;
footerAction?: React.ReactNode;
headerComponent?: React.ReactNode;
size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';
isFullscreenScroll?: boolean;
bodyStyle?: React.CSSProperties;
className?: string;
hideCancelButton?: boolean;
}
const BaseModal = ({
isOpen,
close,
title,
children,
headerComponent,
confirmAction,
footerAction = null,
size = 'lg',
isFullscreenScroll = true,
bodyStyle,
className,
hideCancelButton = false,
}: BaseModalProps) => (
<ModalDialog
isOpen={isOpen}
onClose={close}
size={size}
variant="default"
hasCloseButton
isFullscreenOnMobile
isFullscreenScroll={isFullscreenScroll}
title={title}
className={className}
isOverflowVisible={false}
>
<ModalDialog.Header style={{ zIndex: 1, boxShadow: '2px 2px 5px rgba(0, 0, 0, 0.3)' }}>
<ModalDialog.Title>
{title}
</ModalDialog.Title>
{headerComponent}
</ModalDialog.Header>
<Scrollable style={bodyStyle}>
<ModalDialog.Body>
{children}
</ModalDialog.Body>
</Scrollable>
<ModalDialog.Footer>
<ActionRow>
{footerAction && (
<>
{footerAction}
<ActionRow.Spacer />
</>
)}
{!hideCancelButton && (
<ModalDialog.CloseButton variant="tertiary" onClick={close}>
<FormattedMessage {...messages.cancelButtonLabel} />
</ModalDialog.CloseButton>
)}
{confirmAction}
</ActionRow>
</ModalDialog.Footer>
</ModalDialog>
);
export default BaseModal;