| 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210 |
89x
89x
| import React from 'react';
import PropTypes from 'prop-types';
class Card extends React.Component {
static displayName = 'Card';
// constructor (props) {
// super(props);
//
// this.state = {
// animationClass: ''
// };
// this.closeModal = this.closeModal.bind(this);
// }
// componentWillReceiveProps(nextProps){
// this.props.show !== nextProps.show
// && nextProps.show
// && setTimeout(() => {
// this.setState({ animationClass: 'in' });
// }, 0);
// }
//
// closeModal () {
// this.setState({ animationClass: '' });
//
// return setTimeout(() => {
// this.props.onHide();
// }, 300);
// }
//
// getModalContent () {
// const {headerLabel, showCloseButton, size} = this.props;
//
// return (
// <div
// className={`modal-content ${size}`}
// >
// {
// headerLabel
// &&
// <ModalHeader
// showCloseButton={showCloseButton}
// headerLabel={headerLabel}
// onHide={this.closeModal}
// />
// }
// {this.props.children}
// </div>
// );
// }
render() {
const {
headerLabel,
label,
headerBorder,
headerColor,
headerAlign,
sizeNum,
nav,
// className,
// size,
// backdrop,
// backdropClickExit,
// escapeExits,
// htmlId
} = this.props;
//
// const renderModal = () => {
// return show
// && (
// <AriaModal
// onExit={this.closeModal}
// getApplicationNode={() => document.querySelector('#app')}
// dialogClass={
// `reveal-modal` +
// ` ${size === 'dialog' ? 'dialog' : 'full'}` +
// ` ${size === 'dialog' ? 'fade' : 'reveal-bottom'}` +
// ` ${className}` +
// ` ${this.state.animationClass}`
// }
// dialogStyle={{
// zIndex: 1051,
// display: 'block',
// visibility: 'visible'
// }}
// includeDefaultStyles={false}
// titleId={htmlId}
// key={1}
// underlayStyle={
// backdrop
// ? {
// zIndex: 1040,
// display: 'block',
// visibility: 'visible'
// }
// : {}
// }
// underlayClass={
// backdrop
// ? (
// `reveal-modal-bg fade` +
// ` ${this.state.animationClass}`
// )
// : ''
// }
// underlayClickExits={backdropClickExit}
// escapeExits={escapeExits}
// >
// {this.getModalContent()}
// </AriaModal>
// );
// };
const getHeader = () => {
return (
<header className={`${(headerAlign && `align-${headerAlign}`) || ''}`}>
<h4>{headerLabel}</h4>
</header>
);
};
return (
<div
className={
'cui-card' +
`${(sizeNum && ` cui-card--${sizeNum}`) || ''}` +
`${(nav && ' cui-card--nav') || ''}` +
`${(headerBorder && ' header-border') || ''}` +
`${(headerColor && ` header-background ${headerColor}`) || ''}`
}
>
<article style={nav && { padding: '1rem', textAlign: 'center' }}>
{headerLabel && getHeader()}
<h4>{label}</h4>
</article>
</div>
);
}
}
Card.defaultProps = {
header: '',
headerAlign: null,
headerBackground: '',
headerBorder: false,
headerColor: '',
headerLabel: '',
label: '',
size: '',
sizeNum: 0,
nav: false,
// children: null,
// show: false,
// size: 'default',
// backdrop: true,
// className: '',
// showCloseButton: true,
// headerLabel: '',
// backdropClickExit: false,
// escapeExits: true
};
Card.propTypes = {
// /** Unique HTML ID. Used for tying label to HTML input. Handy hook for automated testing. */
// htmlId: PropTypes.string.isRequired,
// /**
// * Children components
// */
// children: PropTypes.node,
// /**
// * show/hide modal.
// */
// show: PropTypes.bool.isRequired,
// /**
// * callback function invoked on close of the modal. modal can be closed on click of cross button or esc key.
// * onHide is mandatory props, if not passed modal can not be closed.
// */
// onHide: PropTypes.func.isRequired,
// /**
// * css class names
// */
// className: PropTypes.string,
// /**
// * To show/hide backdrop of the modal.
// * if backdrop is false then modal will become normal popup without backdrop and user can perform any action in parent screen.
// */
// backdrop: PropTypes.bool,
/** @prop Alignment of header | null */
headerAlign: PropTypes.oneOf(['left', 'center']),
/** @prop Set visitibility of the header's border | false */
headerBorder: PropTypes.bool,
/** @prop Set header color | '' */
headerColor: PropTypes.string,
/** @prop Set header's Text | '' */
headerLabel: PropTypes.string,
/** @prop Set Card Text | '' */
label: PropTypes.string,
/** @prop Set size of the card from list of prefined strings | '' */
size: PropTypes.oneOf(['small', 'medium', 'large', 'full']),
/** @prop Set number to define size | 0 */
sizeNum: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
/** @prop Sets of Card is used for nav | false */
nav: PropTypes.bool,
};
export default Card;
|