@xaypay/tui 0.0.73 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +433 -187
- package/dist/index.js +433 -187
- package/package.json +1 -1
- package/src/components/icon/Close.js +19 -0
- package/src/components/icon/CloseSlide.js +19 -0
- package/src/components/icon/Next.js +21 -0
- package/src/components/icon/Prev.js +21 -0
- package/src/components/icon/index.js +1 -2
- package/src/components/modal/index.js +296 -69
- package/src/components/modal/modal.module.css +14 -65
- package/src/components/modal/modal.stories.js +26 -7
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +3 -2
- package/src/components/newAutocomplete/index.js +12 -2
- package/src/components/select/index.js +1 -1
- package/src/stories/configuration.stories.mdx +16 -0
- package/src/stories/static/modal-usage.png +0 -0
- package/src/stories/usage.stories.mdx +5 -1
- package/tui.config.js +13 -0
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgClose = ({ title, titleId, ...props }) => (
|
|
3
|
+
<svg
|
|
4
|
+
width="18"
|
|
5
|
+
height="18"
|
|
6
|
+
viewBox="0 0 18 18"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
aria-labelledby={titleId}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
{title ? <title id={titleId}>{title}</title> : null}
|
|
13
|
+
<path
|
|
14
|
+
d="m10.47 8.95 7.29-7.29A1 1 0 0 0 16.35.25L9.06 7.54 1.77.24A1 1 0 0 0 .36 1.65l7.29 7.3-7.3 7.29a.999.999 0 1 0 1.41 1.41l7.3-7.29 7.29 7.29a1 1 0 0 0 1.41-1.41l-7.29-7.29Z"
|
|
15
|
+
fill="#3C393E"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
export default SvgClose;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgCloseSlide = ({ title, titleId, ...props }) => (
|
|
3
|
+
<svg
|
|
4
|
+
width="18"
|
|
5
|
+
height="18"
|
|
6
|
+
viewBox="0 0 18 18"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
aria-labelledby={titleId}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
{title ? <title id={titleId}>{title}</title> : null}
|
|
13
|
+
<path
|
|
14
|
+
d="m10.47 8.95 7.29-7.29A1 1 0 0 0 16.35.25L9.06 7.54 1.77.24A1 1 0 0 0 .36 1.65l7.29 7.3-7.3 7.29a.999.999 0 1 0 1.41 1.41l7.3-7.29 7.29 7.29a1 1 0 0 0 1.41-1.41l-7.29-7.29Z"
|
|
15
|
+
fill="#fff"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
export default SvgCloseSlide;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgNext = ({ title, titleId, ...props }) => (
|
|
3
|
+
<svg
|
|
4
|
+
width="24"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
aria-labelledby={titleId}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
{title ? <title id={titleId}>{title}</title> : null}
|
|
13
|
+
<path
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clipRule="evenodd"
|
|
16
|
+
d="M12 24c6.627 0 12-5.373 12-12S18.627 0 12 0 0 5.373 0 12s5.373 12 12 12Zm3.4-11.443a.854.854 0 0 0 .198-.548.855.855 0 0 0-.146-.539l-4.137-5.134a.857.857 0 0 0-1.251-.12.856.856 0 0 0-.129 1.207l3.701 4.586-3.838 4.587a.856.856 0 0 0 .739 1.4.858.858 0 0 0 .58-.305l4.284-5.134Z"
|
|
17
|
+
fill="#fff"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
export default SvgNext;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgPrev = ({ title, titleId, ...props }) => (
|
|
3
|
+
<svg
|
|
4
|
+
width="24"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
aria-labelledby={titleId}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
{title ? <title id={titleId}>{title}</title> : null}
|
|
13
|
+
<path
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clipRule="evenodd"
|
|
16
|
+
d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0ZM8.6 11.443a.855.855 0 0 0-.198.548c-.013.19.038.38.146.539l4.137 5.133a.857.857 0 0 0 1.251.12.856.856 0 0 0 .129-1.206l-3.701-4.586 3.838-4.587a.856.856 0 0 0-.739-1.4.858.858 0 0 0-.58.305l-4.284 5.134Z"
|
|
17
|
+
fill="#fff"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
export default SvgPrev;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { default as Png } from "./Png";
|
|
1
|
+
|
|
@@ -1,95 +1,322 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import classnames from
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
|
|
5
|
+
import { compereConfigs } from "./../../utils";
|
|
6
|
+
import styles from './modal.module.css';
|
|
7
|
+
|
|
8
|
+
import SvgNext from './../icon/Next';
|
|
9
|
+
import SvgPrev from './../icon/Prev';
|
|
10
|
+
import SvgCloseIcon from './../icon/CloseIcon';
|
|
11
|
+
import SvgCloseSlide from './../icon/CloseSlide';
|
|
7
12
|
|
|
8
13
|
export const Modal = ({
|
|
9
|
-
setShow,
|
|
10
|
-
headerText,
|
|
11
|
-
className,
|
|
12
14
|
type,
|
|
13
15
|
data,
|
|
16
|
+
radius,
|
|
17
|
+
padding,
|
|
18
|
+
setShow,
|
|
14
19
|
selected,
|
|
15
20
|
children,
|
|
21
|
+
minWidth,
|
|
22
|
+
minHeight,
|
|
23
|
+
className,
|
|
24
|
+
headerText,
|
|
25
|
+
imageWidth,
|
|
26
|
+
headerSize,
|
|
27
|
+
imageHeight,
|
|
28
|
+
headerColor,
|
|
29
|
+
headerWeight,
|
|
30
|
+
headerHeight,
|
|
31
|
+
backgroundColor,
|
|
32
|
+
layerBackgroundColor,
|
|
16
33
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
const [
|
|
34
|
+
const [select, setSelect] = useState(0);
|
|
35
|
+
const [innerData, setInnerData] = useState([]);
|
|
36
|
+
|
|
37
|
+
const configStyles = compereConfigs();
|
|
38
|
+
const classProps = classnames(className);
|
|
39
|
+
|
|
40
|
+
const handleCloseModal = () => {
|
|
41
|
+
setShow(false)
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleStopClosing = (e) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const handleGoTo = (e) => {
|
|
49
|
+
const goTo = e.target.getAttribute('data-go');
|
|
50
|
+
if (goTo === 'next') {
|
|
51
|
+
if (select >= data.length - 1) {
|
|
52
|
+
setSelect(0);
|
|
53
|
+
} else {
|
|
54
|
+
setSelect(select + 1);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
if (select <= 0) {
|
|
58
|
+
setSelect(data.length - 1);
|
|
59
|
+
} else {
|
|
60
|
+
setSelect(select - 1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (type === 'images') {
|
|
67
|
+
if (data) {
|
|
68
|
+
if (data.length === 0) {
|
|
69
|
+
alert('Please fill data prop');
|
|
70
|
+
} else {
|
|
71
|
+
setInnerData(data);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
alert('Please add data prop on Modal component');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, [type, data, data?.length]);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (selected) {
|
|
81
|
+
if (selected <= 0) {
|
|
82
|
+
setSelect(0);
|
|
83
|
+
} else if (selected >= data.length - 1) {
|
|
84
|
+
setSelect(data.length - 1);
|
|
85
|
+
} else {
|
|
86
|
+
setSelect(selected);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, [selected]);
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
return () => {
|
|
93
|
+
setSelect(0);
|
|
94
|
+
setInnerData([]);
|
|
95
|
+
}
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
19
98
|
return (
|
|
20
|
-
<div
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<div className={`${styles["modal-section"]} modal-section-rem`}>{children}</div>
|
|
40
|
-
</div>
|
|
41
|
-
) : type == "images" ? (
|
|
99
|
+
<div
|
|
100
|
+
onClick={handleCloseModal}
|
|
101
|
+
style={{
|
|
102
|
+
top: '0px',
|
|
103
|
+
left: '0px',
|
|
104
|
+
zIndex: 999,
|
|
105
|
+
width: '100%',
|
|
106
|
+
height: '100vh',
|
|
107
|
+
position: 'fixed',
|
|
108
|
+
backgroundColor: layerBackgroundColor ? layerBackgroundColor : configStyles.MODAL.layerBackgroundColor
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<div
|
|
112
|
+
style={{
|
|
113
|
+
position: 'relative',
|
|
114
|
+
width: '100%',
|
|
115
|
+
height: '100vh'
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
42
118
|
<div
|
|
43
|
-
className={`${styles[
|
|
44
|
-
onClick={
|
|
45
|
-
|
|
119
|
+
className={`${classProps} ${styles['animation__modal']}`}
|
|
120
|
+
onClick={handleStopClosing}
|
|
121
|
+
style={{
|
|
122
|
+
top: '0px',
|
|
123
|
+
left: '0px',
|
|
124
|
+
right: '0px',
|
|
125
|
+
bottom: '0px',
|
|
126
|
+
margin: 'auto',
|
|
127
|
+
maxWidth: '95%',
|
|
128
|
+
overflow: 'auto',
|
|
129
|
+
maxHeight: '95vh',
|
|
130
|
+
position: 'absolute',
|
|
131
|
+
width: 'fit-content',
|
|
132
|
+
height: 'fit-content',
|
|
133
|
+
boxSizing: 'border-box',
|
|
134
|
+
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
135
|
+
minWidth: type === 'content' ? minWidth ? minWidth : '' : '',
|
|
136
|
+
minHeight: type === 'content' ? minHeight ? minHeight : '' : '',
|
|
137
|
+
padding: type === 'content' ? padding ? padding : configStyles.MODAL.padding : '10px',
|
|
138
|
+
backgroundColor: backgroundColor ? backgroundColor : configStyles.MODAL.backgroundColor,
|
|
46
139
|
}}
|
|
47
140
|
>
|
|
48
141
|
<div
|
|
49
|
-
|
|
50
|
-
|
|
142
|
+
style={{
|
|
143
|
+
position: 'relative',
|
|
144
|
+
width: '100%',
|
|
145
|
+
height: '100%'
|
|
146
|
+
}}
|
|
51
147
|
>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<img
|
|
64
|
-
width="600px"
|
|
65
|
-
key={elem.id}
|
|
66
|
-
src={elem.url}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
})}
|
|
71
|
-
{select < data.length ? (
|
|
72
|
-
<h1
|
|
73
|
-
onClick={() => {
|
|
74
|
-
setSelect(select + 1);
|
|
148
|
+
{
|
|
149
|
+
type === 'content'
|
|
150
|
+
?
|
|
151
|
+
<div
|
|
152
|
+
style={{
|
|
153
|
+
width: '100%',
|
|
154
|
+
display: 'flex',
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
height: headerHeight ? headerHeight : configStyles.MODAL.headerHeight,
|
|
157
|
+
justifyContent: headerText && type === 'content' ? 'space-between' : 'flex-end',
|
|
75
158
|
}}
|
|
76
159
|
>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
160
|
+
{
|
|
161
|
+
headerText && type === 'content' && <p
|
|
162
|
+
style={{
|
|
163
|
+
overflow: 'hidden',
|
|
164
|
+
whiteSpace: 'nowrap',
|
|
165
|
+
textOverflow: 'ellipsis',
|
|
166
|
+
margin: '0px 16px 0px 0px',
|
|
167
|
+
maxWidth: 'calc(100% - 30px)',
|
|
168
|
+
fontSize: headerSize ? headerSize : configStyles.MODAL.headerSize,
|
|
169
|
+
color: headerColor ? headerColor : configStyles.MODAL.headerColor,
|
|
170
|
+
fontWeight: headerWeight ? headerWeight : configStyles.MODAL.headerWeight
|
|
171
|
+
}}
|
|
172
|
+
>{headerText}</p>
|
|
173
|
+
}
|
|
174
|
+
<div
|
|
175
|
+
onClick={handleCloseModal}
|
|
176
|
+
style={{
|
|
177
|
+
width: '14px',
|
|
178
|
+
height: '14px',
|
|
179
|
+
cursor: 'pointer'
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
<SvgCloseIcon />
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
:
|
|
186
|
+
<button
|
|
187
|
+
onClick={handleCloseModal}
|
|
188
|
+
style={{
|
|
189
|
+
position: 'absolute',
|
|
190
|
+
top: '23px',
|
|
191
|
+
width: '18px',
|
|
192
|
+
right: '23px',
|
|
193
|
+
height: '18px',
|
|
194
|
+
border: 'none',
|
|
195
|
+
outline: 'none',
|
|
196
|
+
cursor: 'pointer',
|
|
197
|
+
backgroundColor: 'transparent'
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
<SvgCloseSlide />
|
|
201
|
+
</button>
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
<div
|
|
205
|
+
style={{
|
|
206
|
+
display: 'flex',
|
|
207
|
+
alignItems: 'center',
|
|
208
|
+
boxSizing: 'border-box',
|
|
209
|
+
justifyContent: 'center',
|
|
210
|
+
paddingTop: type === 'content' ? '10px' : '0px'
|
|
211
|
+
}}
|
|
212
|
+
>
|
|
213
|
+
{
|
|
214
|
+
type === 'content'
|
|
215
|
+
?
|
|
216
|
+
children ? children : ''
|
|
217
|
+
:
|
|
218
|
+
<div
|
|
219
|
+
style={{
|
|
220
|
+
width: '100%',
|
|
221
|
+
display: 'flex',
|
|
222
|
+
alignItems: 'center'
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
{
|
|
226
|
+
innerData && innerData.length > 0 && innerData.map((item, index) => {
|
|
227
|
+
if (select === index) {
|
|
228
|
+
if (!item.hasOwnProperty('url')) {
|
|
229
|
+
alert('Please add url property in data prop on each element');
|
|
230
|
+
} else {
|
|
231
|
+
return (
|
|
232
|
+
<img
|
|
233
|
+
style={{
|
|
234
|
+
objectFit: 'cover',
|
|
235
|
+
objectPosition: 'center',
|
|
236
|
+
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
237
|
+
width: imageWidth ? imageWidth : configStyles.MODAL.imageWidth,
|
|
238
|
+
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
239
|
+
}}
|
|
240
|
+
src={item.url}
|
|
241
|
+
key={item.id ? item.id : index}
|
|
242
|
+
/>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
{
|
|
250
|
+
innerData && innerData.length > 1 && <>
|
|
251
|
+
<button
|
|
252
|
+
onClick={handleGoTo}
|
|
253
|
+
data-go='prev'
|
|
254
|
+
style={{
|
|
255
|
+
position: 'absolute',
|
|
256
|
+
left: '14px',
|
|
257
|
+
width: '24px',
|
|
258
|
+
height: '24px',
|
|
259
|
+
padding: '0px',
|
|
260
|
+
border: 'none',
|
|
261
|
+
outline: 'none',
|
|
262
|
+
cursor: 'pointer',
|
|
263
|
+
top: 'calc(50% - 12px)',
|
|
264
|
+
backgroundColor: 'transparent'
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
<SvgPrev />
|
|
268
|
+
</button>
|
|
269
|
+
<button
|
|
270
|
+
onClick={handleGoTo}
|
|
271
|
+
data-go='next'
|
|
272
|
+
style={{
|
|
273
|
+
position: 'absolute',
|
|
274
|
+
width: '24px',
|
|
275
|
+
right: '14px',
|
|
276
|
+
height: '24px',
|
|
277
|
+
border: 'none',
|
|
278
|
+
padding: '0px',
|
|
279
|
+
outline: 'none',
|
|
280
|
+
cursor: 'pointer',
|
|
281
|
+
top: 'calc(50% - 12px)',
|
|
282
|
+
backgroundColor: 'transparent'
|
|
283
|
+
}}
|
|
284
|
+
>
|
|
285
|
+
<SvgNext />
|
|
286
|
+
</button>
|
|
287
|
+
</>
|
|
288
|
+
}
|
|
289
|
+
</div>
|
|
290
|
+
}
|
|
80
291
|
</div>
|
|
81
292
|
</div>
|
|
82
293
|
</div>
|
|
83
|
-
|
|
294
|
+
</div>
|
|
84
295
|
</div>
|
|
85
296
|
);
|
|
86
297
|
};
|
|
87
298
|
|
|
88
299
|
Modal.propTypes = {
|
|
300
|
+
data: PropTypes.array,
|
|
301
|
+
type: PropTypes.string,
|
|
89
302
|
setShow: PropTypes.func,
|
|
90
|
-
|
|
303
|
+
radius: PropTypes.string,
|
|
304
|
+
padding: PropTypes.string,
|
|
305
|
+
selected: PropTypes.number,
|
|
306
|
+
minWidth: PropTypes.string,
|
|
307
|
+
minHeight: PropTypes.string,
|
|
91
308
|
className: PropTypes.string,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
309
|
+
headerText: PropTypes.string,
|
|
310
|
+
imageWidth: PropTypes.string,
|
|
311
|
+
headerSize: PropTypes.string,
|
|
312
|
+
headerColor: PropTypes.string,
|
|
313
|
+
imageHeight: PropTypes.string,
|
|
314
|
+
headerWeight: PropTypes.string,
|
|
315
|
+
headerHeight: PropTypes.string,
|
|
316
|
+
backgroundColor: PropTypes.string,
|
|
317
|
+
layerBackgroundColor: PropTypes.string,
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
Modal.defaultProps = {
|
|
321
|
+
type: 'content'
|
|
95
322
|
};
|
|
@@ -1,73 +1,22 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
height: 100%;
|
|
5
|
-
top: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
z-index: 9;
|
|
8
|
-
background: rgba(0,0,0,0.4);
|
|
9
|
-
}
|
|
10
|
-
.modal-top {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: row;
|
|
13
|
-
padding: 4px 10px 4px 0;
|
|
14
|
-
width: 100%;
|
|
15
|
-
background: #fbfbfb;
|
|
16
|
-
height: 44px;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
}
|
|
19
|
-
.modal-title {
|
|
20
|
-
flex: 1 1;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
font-size: 20px;
|
|
24
|
-
padding-right: 20px;
|
|
25
|
-
line-height: 24px;
|
|
26
|
-
font-weight: 500;
|
|
27
|
-
color: #3C393E;
|
|
28
|
-
}
|
|
29
|
-
.close-btn {
|
|
30
|
-
flex: 0 0 auto;
|
|
31
|
-
width: 24px;
|
|
32
|
-
height: 100%;
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
}
|
|
38
|
-
.modal-section {
|
|
39
|
-
flex: 1 1;
|
|
40
|
-
width: 100%;
|
|
41
|
-
height: 100%;
|
|
42
|
-
display: flex;
|
|
43
|
-
align-items: center;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
padding: 10px 0;
|
|
46
|
-
}
|
|
47
|
-
.modal-content {
|
|
48
|
-
position: absolute;
|
|
49
|
-
width: fit-content;
|
|
50
|
-
padding: 10px;
|
|
51
|
-
min-height: 130px;
|
|
52
|
-
top: 110px;
|
|
53
|
-
left: 0;
|
|
54
|
-
right: 0;
|
|
55
|
-
margin: auto;
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
height: auto;
|
|
60
|
-
background: rgba(255,255,255,1);
|
|
61
|
-
border-radius: 8px;
|
|
62
|
-
animation: show-popup 240ms;
|
|
63
|
-
overflow: hidden;
|
|
1
|
+
.animation__modal {
|
|
2
|
+
animation: show-popup 150ms;
|
|
3
|
+
-webkit-animation: show-popup 150ms;
|
|
64
4
|
}
|
|
5
|
+
|
|
65
6
|
@keyframes show-popup {
|
|
66
7
|
0% {
|
|
67
|
-
transform: translate3d(0, -
|
|
8
|
+
transform: translate3d(0, -50%, 0);
|
|
9
|
+
-webkit-transform: translate3d(0, -50%, 0);
|
|
10
|
+
-moz-transform: translate3d(0, -50%, 0);
|
|
11
|
+
-ms-transform: translate3d(0, -50%, 0);
|
|
12
|
+
-o-transform: translate3d(0, -50%, 0);
|
|
68
13
|
}
|
|
69
14
|
100% {
|
|
70
|
-
transform: translate3d(0, 0, 0);
|
|
71
15
|
opacity: 1;
|
|
16
|
+
transform: translate3d(0, 0, 0);
|
|
17
|
+
-webkit-transform: translate3d(0, 0, 0);
|
|
18
|
+
-moz-transform: translate3d(0, 0, 0);
|
|
19
|
+
-ms-transform: translate3d(0, 0, 0);
|
|
20
|
+
-o-transform: translate3d(0, 0, 0);
|
|
72
21
|
}
|
|
73
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useState} from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { Modal } from "./index";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
@@ -8,6 +8,7 @@ export default {
|
|
|
8
8
|
|
|
9
9
|
const Template = ({ headerText, className }) => {
|
|
10
10
|
const [show, setShow] = useState(false);
|
|
11
|
+
const [type, setType] = useState('content');
|
|
11
12
|
const data = [
|
|
12
13
|
{
|
|
13
14
|
url: 'https://images.pexels.com/photos/268533/pexels-photo-268533.jpeg?cs=srgb&dl=pexels-pixabay-268533.jpg&fm=jpg',
|
|
@@ -29,17 +30,35 @@ const Template = ({ headerText, className }) => {
|
|
|
29
30
|
url: 'https://media.istockphoto.com/id/500221043/photo/cascade-yerevan.jpg?s=612x612&w=0&k=20&c=vaULCkIZaIbetZlkFnP20ELnD8cyhlc9cRsvt-X5YAk=',
|
|
30
31
|
id: 5
|
|
31
32
|
}
|
|
32
|
-
]
|
|
33
|
+
];
|
|
34
|
+
|
|
33
35
|
const handleClick = () => {
|
|
34
36
|
setShow(true);
|
|
35
37
|
};
|
|
38
|
+
|
|
39
|
+
const handleChangeType = () => {
|
|
40
|
+
if (type === 'content') {
|
|
41
|
+
setType('images');
|
|
42
|
+
} else {
|
|
43
|
+
setType('content');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
36
47
|
return (
|
|
37
48
|
<>
|
|
38
|
-
<button
|
|
49
|
+
<button
|
|
50
|
+
onClick={handleClick}
|
|
51
|
+
style={{ cursor: 'pointer', padding: '8px', fontSize: '16px', marginRight: '10px' }}
|
|
52
|
+
>Click</button>
|
|
53
|
+
<button
|
|
54
|
+
onClick={handleChangeType}
|
|
55
|
+
style={{ cursor: 'pointer', padding: '8px', fontSize: '16px' }}
|
|
56
|
+
>Change type to {type === 'content' ? 'images' : 'content'}</button>
|
|
39
57
|
{show && (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
<Modal type={type} selected={0} data={data} setShow={setShow} minHeight='400px' minWidth='600px' className={className}>
|
|
59
|
+
<p>
|
|
60
|
+
Children content
|
|
61
|
+
</p>
|
|
43
62
|
</Modal>
|
|
44
63
|
)}
|
|
45
64
|
</>
|
|
@@ -49,6 +68,6 @@ const Template = ({ headerText, className }) => {
|
|
|
49
68
|
export const Default = Template.bind({});
|
|
50
69
|
|
|
51
70
|
Default.args = {
|
|
52
|
-
headerText: "
|
|
71
|
+
headerText: "Modal header text",
|
|
53
72
|
className: "Modal",
|
|
54
73
|
};
|
|
@@ -28,7 +28,7 @@ const Template = (args) => {
|
|
|
28
28
|
method: 'GET',
|
|
29
29
|
headers: {
|
|
30
30
|
'Content-Type': 'application/json',
|
|
31
|
-
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.
|
|
31
|
+
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjRlZTI2OGU3NjhkMjA0YTdiMWM1NjU4NzE2Mjg0OTdjNTlmMmZjYjc4YzdiZTRjYTYzZGUyYjZmNjZjMzU3YjI0MzMwZjRhOTc5OGRjZDY4IiwiaWF0IjoxNjgxMzYzNDI2LjE0NDc0NywibmJmIjoxNjgxMzYzNDI2LjE0NDc1NCwiZXhwIjoxNjgxMzg4NjI2LjExODkzNywic3ViIjoibWluYXNAbWFpbC5ydSIsInNjb3BlcyI6WyJlbWFpbCJdfQ.nGU1Jf4XeVEqOHCXfDsjL-q--jTDrjlACMolSISUpviSaEDVLCI6BpY5_YYjOWRBUr4Utl_guFqpnb9jxbWdugL6_uFBANj1v0bi_g-RlzzeqF0FqlUqf1YZ_8S4c-l8nLsqfSDzPJs3nRB6oJVo7Di2O3fS_ka5MCkTXShzI6UJUZEvV4j60_QD7SmqmnDiij2rnfWt76YrNXZpDHt-zWMw6d7gD_pnX5RJ0YHUaXi2-M9ip-OcJfX4e_w7iMnckecaCfUolIO_rYNnHy6mleHX6Dimu6_niyMr0dj1ph9glv7fOHrIDwXx69AfJ4nuUQBa-G_AE9abot8cVzlPXAkwVa8WVkvH2mtzDgQuBLbQDM2VISqxO8j5jZhC9JDuXKN8TGukiBbePkWmpd9ASYaLQC02OqzZxqCaBBXCd72XMrwIynyjyTAW9t-VeraxFJgZwlqCnwZ7eTiIWSpPT7B5CLVumC24kz_ll8Tdbz4tMo0xdHNggD-hdPhciyVsaLk0q0Hx-vyIlKMS0KPez4EULQT2C3HaR5t81Pf4Qq06zLPXnKXXnoFc_p3u8TGDdqVXQBPdV1W8ck_3-hwIe-QzM5TbqTJjehiiH64QMcFTsJs--2APXNy3nBmU0D98is_eBGgHbgLJgck5v7MgYBaAaPjPf2lxtS-DF76ynQQ',
|
|
32
32
|
},
|
|
33
33
|
}).then((res)=> {
|
|
34
34
|
return res.json()
|
|
@@ -46,5 +46,6 @@ const Template = (args) => {
|
|
|
46
46
|
};
|
|
47
47
|
export const Default = Template.bind({});
|
|
48
48
|
Default.args = {
|
|
49
|
-
searchCount: 3
|
|
49
|
+
searchCount: 3,
|
|
50
|
+
selected: 'Jhon'
|
|
50
51
|
}
|