@pareto-engineering/design-system 2.0.0-alpha.5 → 2.0.0-alpha.9
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/cjs/a/OvalIllustration/OvalIllustration.js +102 -0
- package/dist/cjs/a/OvalIllustration/index.js +15 -0
- package/dist/cjs/a/OvalIllustration/styles.scss +105 -0
- package/dist/cjs/a/Shapes/Shapes.js +31 -9
- package/dist/cjs/a/Shapes/styles.scss +41 -19
- package/dist/cjs/a/index.js +9 -1
- package/dist/cjs/b/Page/common/Section/Section.js +21 -7
- package/dist/es/a/OvalIllustration/OvalIllustration.js +86 -0
- package/dist/es/a/OvalIllustration/index.js +2 -0
- package/dist/es/a/OvalIllustration/styles.scss +105 -0
- package/dist/es/a/Shapes/Shapes.js +31 -9
- package/dist/es/a/Shapes/styles.scss +41 -19
- package/dist/es/a/index.js +2 -1
- package/dist/es/b/Page/common/Section/Section.js +19 -5
- package/package.json +2 -2
- package/src/__snapshots__/Storyshots.test.js.snap +103 -12
- package/src/stories/a/OvalIllustration.stories.jsx +36 -0
- package/src/stories/a/Shapes.stories.jsx +56 -43
- package/src/stories/b/Page.stories.jsx +2 -1
- package/src/ui/a/OvalIllustration/OvalIllustration.jsx +108 -0
- package/src/ui/a/OvalIllustration/index.js +2 -0
- package/src/ui/a/OvalIllustration/styles.scss +105 -0
- package/src/ui/a/Shapes/Shapes.jsx +34 -7
- package/src/ui/a/Shapes/styles.scss +41 -19
- package/src/ui/a/index.js +1 -0
- package/src/ui/b/Page/common/Section/Section.jsx +21 -4
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useLayoutEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem'
|
|
9
|
+
|
|
10
|
+
// Local Definitions
|
|
11
|
+
|
|
12
|
+
const baseClassName = styleNames.base
|
|
13
|
+
|
|
14
|
+
const componentClassName = 'oval-illustration'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const OvalIllustration = ({
|
|
20
|
+
id,
|
|
21
|
+
className:userClassName,
|
|
22
|
+
style,
|
|
23
|
+
layout,
|
|
24
|
+
src,
|
|
25
|
+
alt,
|
|
26
|
+
ovalBackground,
|
|
27
|
+
backgroundColor,
|
|
28
|
+
// ...otherProps
|
|
29
|
+
}) => {
|
|
30
|
+
useLayoutEffect(() => {
|
|
31
|
+
import('./styles.scss')
|
|
32
|
+
}, [])
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
id={id}
|
|
37
|
+
className={[
|
|
38
|
+
|
|
39
|
+
baseClassName,
|
|
40
|
+
|
|
41
|
+
componentClassName,
|
|
42
|
+
userClassName,
|
|
43
|
+
layout,
|
|
44
|
+
]
|
|
45
|
+
.filter((e) => e)
|
|
46
|
+
.join(' ')}
|
|
47
|
+
style={style}
|
|
48
|
+
// {...otherProps}
|
|
49
|
+
>
|
|
50
|
+
{ovalBackground
|
|
51
|
+
&& <div className={`oval-background y-${backgroundColor}`} />}
|
|
52
|
+
<div className="illustration">
|
|
53
|
+
<img src={src} alt={alt} />
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
OvalIllustration.propTypes = {
|
|
60
|
+
/**
|
|
61
|
+
* The HTML id for this element
|
|
62
|
+
*/
|
|
63
|
+
id:PropTypes.string,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The HTML class names for this element
|
|
67
|
+
*/
|
|
68
|
+
className:PropTypes.string,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The React-written, css properties for this element.
|
|
72
|
+
*/
|
|
73
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* side definition of the illustration
|
|
77
|
+
*/
|
|
78
|
+
layout:PropTypes.oneOf([
|
|
79
|
+
'left',
|
|
80
|
+
'right',
|
|
81
|
+
]),
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* image url
|
|
85
|
+
*/
|
|
86
|
+
src:PropTypes.string,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* alt tag for the image
|
|
90
|
+
*/
|
|
91
|
+
alt:PropTypes.string,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* whether to have a oval shape as background
|
|
95
|
+
*/
|
|
96
|
+
ovalBackground:PropTypes.bool,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* background color of the oval behind the image
|
|
100
|
+
*/
|
|
101
|
+
backgroundColor:PropTypes.string,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
OvalIllustration.defaultProps = {
|
|
105
|
+
layout:'left',
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default OvalIllustration
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
|
|
3
|
+
@use "@pareto-engineering/bem";
|
|
4
|
+
@use "@aztlan/stylebook/src/mixins";
|
|
5
|
+
@use "@aztlan/stylebook/src/globals" as *;
|
|
6
|
+
|
|
7
|
+
$default-desktop-shape-size:45em;
|
|
8
|
+
$default-tablet-shape-size:35em;
|
|
9
|
+
$default-mobile-shape-size:20em;
|
|
10
|
+
$default-clockwise-degree:60deg;
|
|
11
|
+
$default-counter-clockwise-degree:-60deg;
|
|
12
|
+
$default-ellipse-size:30% 43% at 50% 50%;
|
|
13
|
+
|
|
14
|
+
.#{bem.$base}.oval-illustration {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
position: relative;
|
|
19
|
+
|
|
20
|
+
&.left {
|
|
21
|
+
.oval-background {
|
|
22
|
+
transform: rotate($default-clockwise-degree);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.illustration {
|
|
26
|
+
transform: rotate($default-counter-clockwise-degree);
|
|
27
|
+
|
|
28
|
+
> img {
|
|
29
|
+
transform: rotate($default-clockwise-degree);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.right {
|
|
35
|
+
.oval-background {
|
|
36
|
+
transform: rotate($default-counter-clockwise-degree);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.illustration {
|
|
40
|
+
transform: rotate($default-clockwise-degree);
|
|
41
|
+
|
|
42
|
+
> img {
|
|
43
|
+
transform: rotate($default-counter-clockwise-degree);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.oval-background {
|
|
49
|
+
background: var(--y);
|
|
50
|
+
clip-path: ellipse($default-ellipse-size);
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
position: absolute;
|
|
53
|
+
z-index: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.illustration {
|
|
57
|
+
clip-path: ellipse($default-ellipse-size);
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
|
|
60
|
+
> img {
|
|
61
|
+
height: 100%;
|
|
62
|
+
object-fit: cover;
|
|
63
|
+
width: 100%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// mobile style
|
|
68
|
+
@include mixins.media($to:$sm-md) {
|
|
69
|
+
.oval-background {
|
|
70
|
+
height: $default-mobile-shape-size;
|
|
71
|
+
width: $default-mobile-shape-size;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.illustration {
|
|
75
|
+
height: $default-mobile-shape-size;
|
|
76
|
+
width: $default-mobile-shape-size;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// tablet style
|
|
81
|
+
@include mixins.media($from:$xs-sm, $to:$sm-md) {
|
|
82
|
+
.oval-background {
|
|
83
|
+
height: $default-tablet-shape-size;
|
|
84
|
+
width: $default-tablet-shape-size;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.illustration {
|
|
88
|
+
height: $default-tablet-shape-size;
|
|
89
|
+
width: $default-tablet-shape-size;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// desktop style
|
|
94
|
+
@include mixins.media($from:$sm-md) {
|
|
95
|
+
.oval-background {
|
|
96
|
+
height: $default-desktop-shape-size;
|
|
97
|
+
width: $default-desktop-shape-size;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.illustration {
|
|
101
|
+
height: $default-desktop-shape-size;
|
|
102
|
+
width: $default-desktop-shape-size;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -20,9 +20,11 @@ const Shapes = ({
|
|
|
20
20
|
id,
|
|
21
21
|
className:userClassName,
|
|
22
22
|
style,
|
|
23
|
-
pin,
|
|
24
23
|
shape,
|
|
25
24
|
height,
|
|
25
|
+
overflow,
|
|
26
|
+
verticalAlign,
|
|
27
|
+
horizontalAlign,
|
|
26
28
|
// ...otherProps
|
|
27
29
|
}) => {
|
|
28
30
|
useLayoutEffect(() => {
|
|
@@ -43,8 +45,10 @@ const Shapes = ({
|
|
|
43
45
|
.join(' ')}
|
|
44
46
|
style={{
|
|
45
47
|
...style,
|
|
46
|
-
'--
|
|
47
|
-
'--
|
|
48
|
+
'--shape-height' :height,
|
|
49
|
+
'--overflow' :overflow,
|
|
50
|
+
'--vertical-align' :verticalAlign,
|
|
51
|
+
'--horizontal-align':horizontalAlign,
|
|
48
52
|
}}
|
|
49
53
|
// {...otherProps}
|
|
50
54
|
>
|
|
@@ -95,6 +99,12 @@ const Shapes = ({
|
|
|
95
99
|
<div className="circle-four" />
|
|
96
100
|
</div>
|
|
97
101
|
)}
|
|
102
|
+
{shape === 'rotated-ellipses' && (
|
|
103
|
+
<div className="rotated-ellipses">
|
|
104
|
+
<div className="ellipse-one" />
|
|
105
|
+
<div className="ellipse-two" />
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
98
108
|
</div>
|
|
99
109
|
)
|
|
100
110
|
}
|
|
@@ -121,9 +131,18 @@ Shapes.propTypes = {
|
|
|
121
131
|
height:PropTypes.string,
|
|
122
132
|
|
|
123
133
|
/**
|
|
124
|
-
*
|
|
134
|
+
* The vertical alignment of the shape.
|
|
135
|
+
*/
|
|
136
|
+
verticalAlign:PropTypes.oneOf([
|
|
137
|
+
'flex-start',
|
|
138
|
+
'center',
|
|
139
|
+
'flex-end',
|
|
140
|
+
]),
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The horizontal alignment of the shape.
|
|
125
144
|
*/
|
|
126
|
-
|
|
145
|
+
horizontalAlign:PropTypes.oneOf([
|
|
127
146
|
'flex-start',
|
|
128
147
|
'center',
|
|
129
148
|
'flex-end',
|
|
@@ -143,12 +162,20 @@ Shapes.propTypes = {
|
|
|
143
162
|
'half-circle',
|
|
144
163
|
'ellipses',
|
|
145
164
|
'rectangles',
|
|
165
|
+
'rotated-ellipses',
|
|
146
166
|
]),
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The overflow of the shape.
|
|
170
|
+
*/
|
|
171
|
+
overflow:PropTypes.oneOf(['hidden', 'visible']),
|
|
147
172
|
}
|
|
148
173
|
|
|
149
174
|
Shapes.defaultProps = {
|
|
150
|
-
|
|
151
|
-
|
|
175
|
+
verticalAlign :'center',
|
|
176
|
+
horizontalAlign:'center',
|
|
177
|
+
shape :'triangle',
|
|
178
|
+
overflow :'hidden',
|
|
152
179
|
}
|
|
153
180
|
|
|
154
181
|
export default Shapes
|
|
@@ -15,8 +15,9 @@ $default-shapes-opacity:.8;
|
|
|
15
15
|
left: 0;
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: column;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
overflow: var(--overflow);
|
|
19
|
+
justify-content: var(--vertical-align);
|
|
20
|
+
align-items: var(--horizontal-align);
|
|
20
21
|
height: 100%;
|
|
21
22
|
width: 100%;
|
|
22
23
|
|
|
@@ -34,24 +35,23 @@ $default-shapes-opacity:.8;
|
|
|
34
35
|
width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
|
|
35
36
|
|
|
36
37
|
.up {
|
|
37
|
-
background-image:
|
|
38
|
-
clip-path: ellipse(
|
|
38
|
+
background-image: radial-gradient(ellipse at center bottom, var(--y) 5%, transparent 65%);
|
|
39
|
+
clip-path: ellipse(35% 100% at 50% 0%);
|
|
39
40
|
height: 50%;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
.down {
|
|
43
|
-
background-image:
|
|
44
|
-
clip-path: ellipse(
|
|
44
|
+
background-image: radial-gradient(ellipse at center top, var(--y) 5%, transparent 65%);
|
|
45
|
+
clip-path: ellipse(35% 100% at 50% 100%);
|
|
45
46
|
height: 50%;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
.ellipse {
|
|
50
|
-
background-image: linear-gradient(
|
|
51
|
-
clip-path: ellipse(50%
|
|
51
|
+
background-image: linear-gradient(var(--dark-y), var(--light-y));
|
|
52
|
+
clip-path: ellipse(50% 50% at 50% 50%);
|
|
52
53
|
height: var(--shape-height, #{$default-ellipse-height});
|
|
53
54
|
opacity: $default-shapes-opacity;
|
|
54
|
-
transform: rotate3d(0, 0, -1, 10deg);
|
|
55
55
|
width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -109,8 +109,8 @@ $default-shapes-opacity:.8;
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
.half-ellipse {
|
|
112
|
-
background-image:
|
|
113
|
-
clip-path: ellipse(
|
|
112
|
+
background-image: radial-gradient(ellipse at center bottom, var(--y) 10%, transparent 65%);
|
|
113
|
+
clip-path: ellipse(60% 100% at 50% 0%);
|
|
114
114
|
height: var(--shape-height, #{$default-ellipse-height});
|
|
115
115
|
opacity: $default-shapes-opacity;
|
|
116
116
|
width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
|
|
@@ -174,26 +174,48 @@ $default-shapes-opacity:.8;
|
|
|
174
174
|
|
|
175
175
|
.circle-one {
|
|
176
176
|
transform: rotate(45deg);
|
|
177
|
-
height:
|
|
178
|
-
width:
|
|
177
|
+
height:calc(var(--shape-height, #{$default-ellipse-height})* 0.4);
|
|
178
|
+
width: calc(var(--shape-height, #{$default-ellipse-height})* 0.4);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
.circle-two {
|
|
182
|
-
height:
|
|
183
|
-
width:
|
|
182
|
+
height: calc(var(--shape-height, #{$default-ellipse-height})* 0.6);
|
|
183
|
+
width: calc(var(--shape-height, #{$default-ellipse-height})* 0.6);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
.circle-three {
|
|
187
187
|
transform: rotate(-45deg);
|
|
188
|
-
height:
|
|
189
|
-
width:
|
|
188
|
+
height: calc(var(--shape-height, #{$default-ellipse-height})* 0.8);
|
|
189
|
+
width: calc(var(--shape-height, #{$default-ellipse-height})* 0.8);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
.circle-four {
|
|
193
193
|
transform: rotate(-90deg);
|
|
194
|
-
height:
|
|
195
|
-
width:
|
|
194
|
+
height: calc(var(--shape-height, #{$default-ellipse-height})* 1);
|
|
195
|
+
width: calc(var(--shape-height, #{$default-ellipse-height})* 1);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
+
.rotated-ellipses {
|
|
199
|
+
height: var(--shape-height, #{$default-ellipse-height});
|
|
200
|
+
opacity: $default-shapes-opacity;
|
|
201
|
+
width: var(--shape-height, #{$default-ellipse-height});
|
|
202
|
+
display: flex;
|
|
198
203
|
|
|
204
|
+
> *{
|
|
205
|
+
width: 100%;
|
|
206
|
+
height: 100%;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.ellipse-one {
|
|
210
|
+
background-image: radial-gradient(ellipse at bottom left, var(--y) 30%, transparent 65%);
|
|
211
|
+
transform: rotate(-15deg);
|
|
212
|
+
clip-path: ellipse(50% 35% at 50% 50%);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.ellipse-two {
|
|
216
|
+
background-image: radial-gradient(ellipse at top right, var(--y) 30%, transparent 65%);
|
|
217
|
+
transform: rotate(-15deg);
|
|
218
|
+
clip-path: ellipse(50% 35% at 50% 50%);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
199
221
|
}
|
package/src/ui/a/index.js
CHANGED
|
@@ -16,8 +16,10 @@ const Section = ({
|
|
|
16
16
|
style,
|
|
17
17
|
children,
|
|
18
18
|
backgroundShape,
|
|
19
|
-
|
|
19
|
+
backgroundVerticalAlign,
|
|
20
|
+
backgroundHorizontalAlign,
|
|
20
21
|
backgroundHeight,
|
|
22
|
+
backgroundOverflow,
|
|
21
23
|
...otherProps
|
|
22
24
|
}) => {
|
|
23
25
|
const {
|
|
@@ -40,7 +42,13 @@ const Section = ({
|
|
|
40
42
|
>
|
|
41
43
|
{children}
|
|
42
44
|
{backgroundShape && (
|
|
43
|
-
<Shapes
|
|
45
|
+
<Shapes
|
|
46
|
+
verticalAlign={backgroundVerticalAlign}
|
|
47
|
+
horizontalAlign={backgroundHorizontalAlign}
|
|
48
|
+
backgroundOverflow={backgroundOverflow}
|
|
49
|
+
height={backgroundHeight}
|
|
50
|
+
shape={backgroundShape}
|
|
51
|
+
/>
|
|
44
52
|
)}
|
|
45
53
|
</section>
|
|
46
54
|
)
|
|
@@ -84,14 +92,23 @@ Section.propTypes = {
|
|
|
84
92
|
]),
|
|
85
93
|
|
|
86
94
|
/**
|
|
87
|
-
* The background
|
|
95
|
+
* The background vertical alingment to use for if the background shape is set.
|
|
88
96
|
*/
|
|
89
|
-
|
|
97
|
+
backgroundVerticalAlign :PropTypes.oneOf(['flex-start', 'center', 'flex-end']),
|
|
98
|
+
/**
|
|
99
|
+
* The background horizontal alingment to use for if the background shape is set.
|
|
100
|
+
*/
|
|
101
|
+
backgroundHorizontalAlign:PropTypes.oneOf(['flex-start', 'center', 'flex-end']),
|
|
90
102
|
|
|
91
103
|
/**
|
|
92
104
|
* The background height to use for if the background shape is set.
|
|
93
105
|
*/
|
|
94
106
|
backgroundHeight:PropTypes.string,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The background overflow to use for if the background shape is set.
|
|
110
|
+
*/
|
|
111
|
+
backgroundOverflow:PropTypes.oneOf(['visible', 'hidden', 'scroll']),
|
|
95
112
|
}
|
|
96
113
|
|
|
97
114
|
Section.defaultProps = {
|