@platformatic/ui-components 0.1.147 → 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 +1 -1
- package/src/components/Modal.jsx +11 -4
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,10 +79,17 @@ 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
|
-
|
|
91
|
+
|
|
92
|
+
<div className={`${styles['blur-fixed']}`} onClick={(event) => closeModal(event)} ref={blurRef}>
|
|
87
93
|
<div className={styles.content}>
|
|
88
94
|
<div className={modalClassName}>
|
|
89
95
|
<div className={headerClassName}>
|
|
@@ -96,6 +102,7 @@ function Modal ({
|
|
|
96
102
|
</div>
|
|
97
103
|
</div>
|
|
98
104
|
</div>
|
|
105
|
+
|
|
99
106
|
)
|
|
100
107
|
break
|
|
101
108
|
case MODAL_POPUP:
|