@platformatic/ui-components 0.1.91 → 0.1.92
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
|
@@ -7,10 +7,25 @@ import Logo from './Logo'
|
|
|
7
7
|
import Logos from './logos'
|
|
8
8
|
import styles from './Modal.module.css'
|
|
9
9
|
import commonStyles from './Common.module.css'
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
MODAL_SIZES,
|
|
12
|
+
SMALL,
|
|
13
|
+
MODAL_LAYOUTS,
|
|
14
|
+
MODAL_COVER,
|
|
15
|
+
MODAL_POPUP,
|
|
16
|
+
MAIN_DARK_BLUE,
|
|
17
|
+
BACKGROUND_COLOR_OPAQUE,
|
|
18
|
+
LARGE,
|
|
19
|
+
PROFILES,
|
|
20
|
+
FREE,
|
|
21
|
+
BASIC,
|
|
22
|
+
MODAL_FULL_DARK,
|
|
23
|
+
MODAL_FULL_LIGHT,
|
|
24
|
+
WHITE
|
|
25
|
+
} from './constants'
|
|
11
26
|
import PlatformaticIcon from './PlatformaticIcon'
|
|
12
27
|
|
|
13
|
-
function Modal ({ setIsOpen, title, layout, children, size, profile }) {
|
|
28
|
+
function Modal ({ setIsOpen, title, layout, children, size, profile, backgroundClassName }) {
|
|
14
29
|
let contentFullscreen
|
|
15
30
|
let titleFullscreen
|
|
16
31
|
let modalClassName = `${styles.modal}`
|
|
@@ -20,11 +35,26 @@ function Modal ({ setIsOpen, title, layout, children, size, profile }) {
|
|
|
20
35
|
let buttonFullRoundedClassName
|
|
21
36
|
|
|
22
37
|
const headerClassName = styles[`header--${layout}`]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
let modalCoverClassName = `${styles.container} ${styles.fullscreen} `
|
|
39
|
+
switch (layout) {
|
|
40
|
+
case MODAL_COVER:
|
|
41
|
+
contentFullscreen = styles[`content--${layout}`]
|
|
42
|
+
titleFullscreen = styles[`title--${layout}`]
|
|
43
|
+
buttonFullRoundedClassName = `${styles['close--cover']} `
|
|
44
|
+
buttonFullRoundedClassName += commonStyles['background-color-light-blue']
|
|
45
|
+
modalCoverClassName += commonStyles['background-color-light-blue']
|
|
46
|
+
break
|
|
47
|
+
|
|
48
|
+
case MODAL_FULL_DARK:
|
|
49
|
+
modalCoverClassName += commonStyles['background-color-main-dark-blue']
|
|
50
|
+
modalCoverClassName += ` ${backgroundClassName}`
|
|
51
|
+
break
|
|
52
|
+
case MODAL_FULL_LIGHT:
|
|
53
|
+
modalCoverClassName += commonStyles['background-color-light-blue']
|
|
54
|
+
break
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
break
|
|
28
58
|
}
|
|
29
59
|
|
|
30
60
|
useEscapeKey(() => setIsOpen(false))
|
|
@@ -62,7 +92,7 @@ function Modal ({ setIsOpen, title, layout, children, size, profile }) {
|
|
|
62
92
|
|
|
63
93
|
case MODAL_COVER:
|
|
64
94
|
whichModal = (
|
|
65
|
-
<div className={
|
|
95
|
+
<div className={modalCoverClassName}>
|
|
66
96
|
<div className={headerClassName}>
|
|
67
97
|
<ButtonFullRounded
|
|
68
98
|
className={buttonFullRoundedClassName}
|
|
@@ -85,6 +115,29 @@ function Modal ({ setIsOpen, title, layout, children, size, profile }) {
|
|
|
85
115
|
)
|
|
86
116
|
break
|
|
87
117
|
|
|
118
|
+
case MODAL_FULL_LIGHT:
|
|
119
|
+
case MODAL_FULL_DARK:
|
|
120
|
+
whichModal = (
|
|
121
|
+
<div className={modalCoverClassName}>
|
|
122
|
+
<div className={headerClassName}>
|
|
123
|
+
<ButtonFullRounded
|
|
124
|
+
className={buttonFullRoundedClassName}
|
|
125
|
+
iconName='CircleCloseIcon'
|
|
126
|
+
iconSize={LARGE}
|
|
127
|
+
iconColor={layout === MODAL_FULL_LIGHT ? MAIN_DARK_BLUE : WHITE}
|
|
128
|
+
hoverEffect={BACKGROUND_COLOR_OPAQUE}
|
|
129
|
+
onClick={() => { setIsOpen(false) }}
|
|
130
|
+
bordered={false}
|
|
131
|
+
alt='Close'
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
<div className={contentFullscreen}>
|
|
135
|
+
<div>{children}</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
)
|
|
139
|
+
break
|
|
140
|
+
|
|
88
141
|
default:
|
|
89
142
|
break
|
|
90
143
|
}
|
|
@@ -115,7 +168,11 @@ Modal.propTypes = {
|
|
|
115
168
|
/**
|
|
116
169
|
* profile
|
|
117
170
|
*/
|
|
118
|
-
profile: PropTypes.oneOf(
|
|
171
|
+
profile: PropTypes.oneOf(PROFILES),
|
|
172
|
+
/**
|
|
173
|
+
* backgroundClassName
|
|
174
|
+
*/
|
|
175
|
+
backgroundClassName: PropTypes.string
|
|
119
176
|
}
|
|
120
177
|
|
|
121
178
|
Modal.defaultProps = {
|
|
@@ -124,7 +181,8 @@ Modal.defaultProps = {
|
|
|
124
181
|
title: '',
|
|
125
182
|
layout: MODAL_POPUP,
|
|
126
183
|
size: SMALL,
|
|
127
|
-
profile: ''
|
|
184
|
+
profile: '',
|
|
185
|
+
backgroundClassName: ''
|
|
128
186
|
}
|
|
129
187
|
|
|
130
188
|
export default Modal
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
@apply bg-light-blue;
|
|
16
16
|
}
|
|
17
17
|
.fullscreen {
|
|
18
|
-
@apply fixed top-0 left-0
|
|
18
|
+
@apply fixed top-0 left-0 h-screen w-full min-h-screen min-w-full py-4 pl-20 pr-4 overflow-y-auto;
|
|
19
19
|
}
|
|
20
20
|
.header--popup {
|
|
21
21
|
@apply flex justify-between items-center;
|
|
22
22
|
}
|
|
23
|
+
.header--full-dark,
|
|
24
|
+
.header--full-light,
|
|
23
25
|
.header--cover {
|
|
24
26
|
@apply flex justify-end;
|
|
25
27
|
}
|
|
@@ -29,6 +31,8 @@
|
|
|
29
31
|
.title {
|
|
30
32
|
@apply font-bold text-[20px];
|
|
31
33
|
}
|
|
34
|
+
.content--full-dark,
|
|
35
|
+
.header--full-light,
|
|
32
36
|
.content--cover {
|
|
33
37
|
@apply h-auto w-full mt-4 mb-10;
|
|
34
38
|
}
|
|
@@ -44,6 +48,8 @@
|
|
|
44
48
|
.modal--full-width {
|
|
45
49
|
@apply w-screen min-w-full;
|
|
46
50
|
}
|
|
51
|
+
.close--full-dark,
|
|
52
|
+
.header--full-light,
|
|
47
53
|
.close--cover {
|
|
48
54
|
@apply mt-4 mr-4;
|
|
49
55
|
}
|
|
@@ -6,6 +6,7 @@ export const DARK_BLUE = 'dark-blue'
|
|
|
6
6
|
export const DARK_GREEN = 'dark-green'
|
|
7
7
|
export const MAIN_GREEN = 'main-green'
|
|
8
8
|
export const TRANSPARENT = 'transparent'
|
|
9
|
+
export const TERTIARY_BLUE = 'tertiary-blue'
|
|
9
10
|
export const ERROR_RED = 'error-red'
|
|
10
11
|
export const WARNING_YELLOW = 'warning-yellow'
|
|
11
12
|
export const NONE = 'none'
|
|
@@ -25,16 +26,20 @@ export const HOVER_EFFECTS_BUTTONS = [BOX_SHADOW, BACKGROUND_COLOR_OPAQUE, UNDER
|
|
|
25
26
|
export const MODAL_SIZES = [SMALL, MEDIUM, FULL_WIDTH]
|
|
26
27
|
|
|
27
28
|
export const COLORS_ICON = [MAIN_GREEN, WHITE, MAIN_DARK_BLUE, ERROR_RED, WARNING_YELLOW]
|
|
28
|
-
export const COLORS_BUTTON = [MAIN_GREEN, DARK_GREEN, LIGHT_GREEN, MAIN_DARK_BLUE, DARK_BLUE, LIGHT_BLUE, WHITE, ERROR_RED,
|
|
29
|
+
export const COLORS_BUTTON = [MAIN_GREEN, DARK_GREEN, LIGHT_GREEN, MAIN_DARK_BLUE, DARK_BLUE, LIGHT_BLUE, WHITE, ERROR_RED, TERTIARY_BLUE, TRANSPARENT]
|
|
29
30
|
export const COLORS_BORDERED_BOX = [MAIN_GREEN, ERROR_RED, WHITE, DARK_BLUE, MAIN_DARK_BLUE, WARNING_YELLOW, TRANSPARENT]
|
|
30
31
|
|
|
31
32
|
export const MODAL_POPUP = 'popup'
|
|
32
33
|
export const MODAL_COVER = 'cover'
|
|
33
|
-
export const
|
|
34
|
+
export const MODAL_FULL_DARK = 'full-dark'
|
|
35
|
+
export const MODAL_FULL_LIGHT = 'full-light'
|
|
36
|
+
export const MODAL_LAYOUTS = [MODAL_POPUP, MODAL_COVER, MODAL_FULL_DARK, MODAL_FULL_LIGHT]
|
|
34
37
|
|
|
35
38
|
export const FREE = 'free'
|
|
36
39
|
export const BASIC = 'basic'
|
|
37
|
-
export const
|
|
40
|
+
export const ADVANCED = 'advanced'
|
|
41
|
+
export const PRO = 'pro'
|
|
42
|
+
export const PROFILES = ['', FREE, BASIC, ADVANCED, PRO]
|
|
38
43
|
|
|
39
44
|
export const FONT_BASE = 'base'
|
|
40
45
|
export const FONT_XS = 'xs'
|
|
@@ -4,7 +4,7 @@ import Button from '../components/Button'
|
|
|
4
4
|
import BorderedBox from '../components/BorderedBox'
|
|
5
5
|
import DropDown from '../components/DropDown'
|
|
6
6
|
import HorizontalSeparator from '../components/HorizontalSeparator'
|
|
7
|
-
import { FULL_WIDTH, MAIN_DARK_BLUE, MAIN_GREEN, MODAL_COVER, MODAL_LAYOUTS, MODAL_SIZES } from '../components/constants'
|
|
7
|
+
import { FULL_WIDTH, MAIN_DARK_BLUE, MAIN_GREEN, MODAL_COVER, MODAL_FULL_DARK, MODAL_FULL_LIGHT, MODAL_LAYOUTS, MODAL_SIZES } from '../components/constants'
|
|
8
8
|
export default {
|
|
9
9
|
title: 'Platformatic/Modal',
|
|
10
10
|
component: Modal,
|
|
@@ -82,9 +82,21 @@ const MenuTemplate = () => {
|
|
|
82
82
|
}
|
|
83
83
|
export const WithDropDown = MenuTemplate.bind({})
|
|
84
84
|
|
|
85
|
-
export const
|
|
86
|
-
|
|
85
|
+
export const FullscreenLayoutLightBlue = Template.bind({})
|
|
86
|
+
FullscreenLayoutLightBlue.args = {
|
|
87
87
|
title: 'Give me an invite',
|
|
88
88
|
size: FULL_WIDTH,
|
|
89
89
|
layout: MODAL_COVER
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
export const FullscreenLayoutDark = Template.bind({})
|
|
93
|
+
FullscreenLayoutDark.args = {
|
|
94
|
+
size: FULL_WIDTH,
|
|
95
|
+
layout: MODAL_FULL_DARK
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const FullscreenLayoutLight = Template.bind({})
|
|
99
|
+
FullscreenLayoutLight.args = {
|
|
100
|
+
size: FULL_WIDTH,
|
|
101
|
+
layout: MODAL_FULL_LIGHT
|
|
102
|
+
}
|