@platformatic/ui-components 0.1.146 → 0.1.148
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/package.json
CHANGED
package/src/components/Modal.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
import React from 'react'
|
|
2
|
+
import React, { useRef } from 'react'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import ButtonFullRounded from './ButtonFullRounded'
|
|
5
5
|
import useEscapeKey from '../hooks/useEscapeKey'
|
|
@@ -41,8 +41,8 @@ function Modal ({
|
|
|
41
41
|
let modalClassName = `${styles.modal}`
|
|
42
42
|
modalClassName += ' ' + styles[`modal--${layout}`]
|
|
43
43
|
modalClassName += ' ' + styles[`modal--${size}`]
|
|
44
|
-
|
|
45
44
|
let buttonFullRoundedClassName
|
|
45
|
+
const blurRef = useRef()
|
|
46
46
|
|
|
47
47
|
const headerClassName = styles[`header--${layout}`]
|
|
48
48
|
let modalCoverClassName = `${styles.container} ${styles.fullscreen} `
|
|
@@ -66,7 +66,6 @@ function Modal ({
|
|
|
66
66
|
default:
|
|
67
67
|
break
|
|
68
68
|
}
|
|
69
|
-
|
|
70
69
|
useEscapeKey(() => setIsOpen(false))
|
|
71
70
|
let whichModal = <></>
|
|
72
71
|
|
|
@@ -80,12 +79,18 @@ function Modal ({
|
|
|
80
79
|
return <Logo width={100} heigth={80} color={MAIN_DARK_BLUE} />
|
|
81
80
|
}
|
|
82
81
|
|
|
82
|
+
function closeModal (event) {
|
|
83
|
+
if (event.target === blurRef.current) {
|
|
84
|
+
setIsOpen(false)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
83
88
|
switch (layout) {
|
|
84
89
|
case MODAL_POPUP_V2:
|
|
85
90
|
whichModal = (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<div className={
|
|
91
|
+
|
|
92
|
+
<div className={`${styles['blur-fixed']}`} onClick={(event) => closeModal(event)} ref={blurRef}>
|
|
93
|
+
<div className={styles.content}>
|
|
89
94
|
<div className={modalClassName}>
|
|
90
95
|
<div className={headerClassName}>
|
|
91
96
|
<div className={titleClassName}>{title}</div>
|
|
@@ -96,7 +101,8 @@ function Modal ({
|
|
|
96
101
|
</div>
|
|
97
102
|
</div>
|
|
98
103
|
</div>
|
|
99
|
-
|
|
104
|
+
</div>
|
|
105
|
+
|
|
100
106
|
)
|
|
101
107
|
break
|
|
102
108
|
case MODAL_POPUP:
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
.blur {
|
|
2
|
-
@apply fixed top-
|
|
2
|
+
@apply fixed top-0 left-0 w-full h-screen z-20;
|
|
3
3
|
background-color: rgba(0, 0, 0, 0.75);
|
|
4
4
|
}
|
|
5
5
|
.blur-absolute {
|
|
6
6
|
@apply absolute top-0 left-0 w-full h-full z-10 bg-rich-black/75;
|
|
7
7
|
}
|
|
8
8
|
.blur-fixed {
|
|
9
|
-
@apply fixed top-0 left-0 w-screen h-full z-
|
|
9
|
+
@apply fixed top-0 left-0 w-screen h-full z-20 bg-rich-black/75 flex justify-center items-center;
|
|
10
|
+
}
|
|
11
|
+
.fixedContainer {
|
|
12
|
+
@apply fixed top-0 left-0 w-full h-screen z-20 ;
|
|
13
|
+
}
|
|
14
|
+
.content {
|
|
15
|
+
@apply fixed top-0 h-[100vH] flex justify-center items-center ;
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
.container {
|
|
@@ -52,7 +58,7 @@
|
|
|
52
58
|
@apply inline-flex items-center;
|
|
53
59
|
}
|
|
54
60
|
.modal--small {
|
|
55
|
-
@apply w-
|
|
61
|
+
@apply w-auto md:min-w-[480px] md:max-w-[480px];
|
|
56
62
|
}
|
|
57
63
|
.modal--medium {
|
|
58
64
|
@apply w-[calc(100vW-2rem)] md:min-w-[480px] md:max-w-[480px] lg:min-w-[880px] lg:max-w-[880px];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.blur {
|
|
2
|
-
@apply
|
|
2
|
+
@apply fixed top-0 left-0 w-full h-full z-10 bg-rich-black/75;
|
|
3
3
|
}
|
|
4
4
|
.container {
|
|
5
5
|
@apply z-20 fixed top-0 -right-[100%] min-h-full h-full bg-rich-black border-solid border-white border-l;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
@apply flex items-center gap-x-2 pb-4;
|
|
24
24
|
}
|
|
25
25
|
.modalLefty {
|
|
26
|
-
@apply p-5
|
|
26
|
+
@apply p-5 xl:py-20 xl:px-[7.5rem] h-[calc(100%-2rem)] xl:h-[calc(100%-10rem)];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
@keyframes come-in {
|
|
@@ -28,13 +28,20 @@ export default {
|
|
|
28
28
|
|
|
29
29
|
const Template = (args) => {
|
|
30
30
|
const [isOpen, setIsOpen] = useState(false)
|
|
31
|
+
const [isOpenInside, setIsOpenInside] = useState(false)
|
|
31
32
|
const { text, ...rest } = args
|
|
32
33
|
return (
|
|
33
|
-
<main>
|
|
34
|
+
<main style={{ height: '1440px', overflow: 'scroll' }}>
|
|
34
35
|
<BorderedBox>This Is another Content</BorderedBox>
|
|
35
|
-
<ContentThatLoads />
|
|
36
36
|
<Button color={MAIN_GREEN} backgroundColor={MAIN_DARK_BLUE} onClick={() => setIsOpen(true)} label='Open Modal' />
|
|
37
37
|
{isOpen && <Modal setIsOpen={setIsOpen} {...rest}>{text}</Modal>}
|
|
38
|
+
|
|
39
|
+
<BorderedBox style={{ position: 'relative' }}>
|
|
40
|
+
<p>This Is another Component with Modal inside</p>
|
|
41
|
+
|
|
42
|
+
<Button color={MAIN_GREEN} backgroundColor={MAIN_DARK_BLUE} onClick={() => setIsOpenInside(true)} label='Open Modal Inside' />
|
|
43
|
+
{isOpenInside && <Modal setIsOpen={setIsOpenInside} {...rest}>{text}</Modal>}
|
|
44
|
+
</BorderedBox>
|
|
38
45
|
</main>
|
|
39
46
|
)
|
|
40
47
|
}
|