@pareto-engineering/design-system 2.0.0-alpha.4 → 2.0.0-alpha.8

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.
@@ -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,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as OvalIllustration } from './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: -100;
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
+ }
@@ -0,0 +1,181 @@
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 = 'shapes'
15
+
16
+ /**
17
+ * This is the component description.
18
+ */
19
+ const Shapes = ({
20
+ id,
21
+ className:userClassName,
22
+ style,
23
+ shape,
24
+ height,
25
+ overflow,
26
+ verticalAlign,
27
+ horizontalAlign,
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
+ ]
44
+ .filter((e) => e)
45
+ .join(' ')}
46
+ style={{
47
+ ...style,
48
+ '--shape-height' :height,
49
+ '--overflow' :overflow,
50
+ '--vertical-align' :verticalAlign,
51
+ '--horizontal-align':horizontalAlign,
52
+ }}
53
+ // {...otherProps}
54
+ >
55
+ { shape === 'triangle'
56
+ && <div className="triangle" />}
57
+ { shape === 'half-ellipses'
58
+ && (
59
+ <div className="half-ellipses">
60
+ <div className="up" />
61
+ <div className="down" />
62
+ </div>
63
+ )}
64
+ { shape === 'ellipse' && <div className="ellipse" />}
65
+ { shape === 'diamonds' && (
66
+ <div className="diamonds">
67
+ <div className="top-right" />
68
+ <div className="bottom-left" />
69
+ <div className="bottom-right" />
70
+ </div>
71
+ )}
72
+ { shape === 'rectangles' && (
73
+ <div className="rectangles">
74
+ <div className="top" />
75
+ <div className="center" />
76
+ <div className="bottom" />
77
+ </div>
78
+ )}
79
+ { shape === 'half-ellipse' && (
80
+ <div className="half-ellipse" />
81
+ )}
82
+ { shape === 'circle' && (
83
+ <div className="circle" />
84
+ )}
85
+ { shape === 'half-circle' && (
86
+ <div className="half-circle" />
87
+ )}
88
+ { shape === 'ellipses' && (
89
+ <div className="ellipses">
90
+ <div className="first" />
91
+ <div className="second" />
92
+ </div>
93
+ )}
94
+ {shape === 'spiral' && (
95
+ <div className="spiral">
96
+ <div className="circle-one" />
97
+ <div className="circle-two" />
98
+ <div className="circle-three" />
99
+ <div className="circle-four" />
100
+ </div>
101
+ )}
102
+ {shape === 'rotated-ellipses' && (
103
+ <div className="rotated-ellipses">
104
+ <div className="ellipse-one" />
105
+ <div className="ellipse-two" />
106
+ </div>
107
+ )}
108
+ </div>
109
+ )
110
+ }
111
+
112
+ Shapes.propTypes = {
113
+ /**
114
+ * The HTML id for this element
115
+ */
116
+ id:PropTypes.string,
117
+
118
+ /**
119
+ * The HTML class names for this element
120
+ */
121
+ className:PropTypes.string,
122
+
123
+ /**
124
+ * The React-written, css properties for this element.
125
+ */
126
+ style:PropTypes.objectOf(PropTypes.string),
127
+
128
+ /**
129
+ * The height of the shape.
130
+ */
131
+ height:PropTypes.string,
132
+
133
+ /**
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.
144
+ */
145
+ horizontalAlign:PropTypes.oneOf([
146
+ 'flex-start',
147
+ 'center',
148
+ 'flex-end',
149
+ ]),
150
+
151
+ /**
152
+ * The options of a shape to use
153
+ */
154
+ shape:PropTypes.oneOf([
155
+ 'triangle',
156
+ 'ellipse',
157
+ 'half-ellipse',
158
+ 'half-ellipses',
159
+ 'spiral',
160
+ 'diamonds',
161
+ 'circle',
162
+ 'half-circle',
163
+ 'ellipses',
164
+ 'rectangles',
165
+ 'rotated-ellipses',
166
+ ]),
167
+
168
+ /**
169
+ * The overflow of the shape.
170
+ */
171
+ overflow:PropTypes.oneOf(['hidden', 'visible']),
172
+ }
173
+
174
+ Shapes.defaultProps = {
175
+ verticalAlign :'center',
176
+ horizontalAlign:'center',
177
+ shape :'triangle',
178
+ overflow :'hidden',
179
+ }
180
+
181
+ export default Shapes
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Shapes } from './Shapes'
@@ -0,0 +1,221 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ $default-ellipse-height:50em;
6
+ $default-diamond-height:40em;
7
+ $default-circle-height:50em;
8
+ $default-triangle-height:40em;
9
+ $default-rectangle-height:50em;
10
+ $default-shapes-opacity:.8;
11
+
12
+ .#{bem.$base}.shapes {
13
+ position: absolute;
14
+ top: 0;
15
+ left: 0;
16
+ display: flex;
17
+ flex-direction: column;
18
+ overflow: var(--overflow);
19
+ justify-content: var(--vertical-align);
20
+ align-items: var(--horizontal-align);
21
+ height: 100%;
22
+ width: 100%;
23
+
24
+ .triangle {
25
+ background-image: linear-gradient(transparent, var(--dark-y));
26
+ clip-path: polygon(0 0, 50% 100%, 100% 0);
27
+ height: calc(var(--shape-height, #{$default-triangle-height}) * 0.86);
28
+ opacity: $default-shapes-opacity;
29
+ width: var(--shape-height, #{$default-triangle-height});
30
+ }
31
+
32
+ .half-ellipses {
33
+ height: var(--shape-height, #{$default-ellipse-height});
34
+ opacity: $default-shapes-opacity;
35
+ width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
36
+
37
+ .up {
38
+ background-image: radial-gradient(ellipse at center bottom, var(--y) 5%, transparent 65%);
39
+ clip-path: ellipse(35% 100% at 50% 0%);
40
+ height: 50%;
41
+ }
42
+
43
+ .down {
44
+ background-image: radial-gradient(ellipse at center top, var(--y) 5%, transparent 65%);
45
+ clip-path: ellipse(35% 100% at 50% 100%);
46
+ height: 50%;
47
+ }
48
+ }
49
+
50
+ .ellipse {
51
+ background-image: linear-gradient(var(--dark-y), var(--light-y));
52
+ clip-path: ellipse(50% 30% at 50% 70%);
53
+ height: var(--shape-height, #{$default-ellipse-height});
54
+ opacity: $default-shapes-opacity;
55
+ width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
56
+ }
57
+
58
+ .diamonds {
59
+ height: var(--shape-height, #{$default-diamond-height});
60
+ opacity: $default-shapes-opacity;
61
+ position: relative;
62
+ width: var(--shape-height, #{$default-diamond-height});
63
+
64
+ .top-right {
65
+ background-image: linear-gradient(to right, var(--dark-y), var(--y));
66
+ clip-path: polygon(100% 100%, 0 0, 100% 0);
67
+ height: 100%;
68
+ position: absolute;
69
+ width: 100%;
70
+ }
71
+
72
+ .bottom-left {
73
+ background-image: linear-gradient(to left, var(--dark-y), var(--y));
74
+ clip-path: polygon(0 100%, 0 0, 100% 100%);
75
+ height: 100%;
76
+ opacity: .95;
77
+ position: absolute;
78
+ width: 100%;
79
+ z-index: 1;
80
+ }
81
+
82
+ .bottom-right {
83
+ background-image: linear-gradient(to bottom, var(--dark-y), var(--y));
84
+ clip-path: polygon(100% 100%, 100% 0, 0 100%);
85
+ height: 100%;
86
+ position: absolute;
87
+ width: 100%;
88
+ }
89
+ }
90
+
91
+ .rectangles {
92
+ display: grid;
93
+ grid-template-rows: repeat(3, 1fr);
94
+ height: var(--shape-height, #{$default-rectangle-height});
95
+ opacity: $default-shapes-opacity;
96
+ width: var(--shape-height, #{$default-rectangle-height});
97
+
98
+ .top {
99
+ background-image: linear-gradient(to right, var(--dark-y), var(--y));
100
+ }
101
+
102
+ .center {
103
+ background-image: linear-gradient(to left, var(--dark-y), var(--y));
104
+ }
105
+
106
+ .bottom {
107
+ background-image: linear-gradient(to right, var(--dark-y), var(--y));
108
+ }
109
+ }
110
+
111
+ .half-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
+ height: var(--shape-height, #{$default-ellipse-height});
115
+ opacity: $default-shapes-opacity;
116
+ width: calc(var(--shape-height, #{$default-ellipse-height}) * 2);
117
+ }
118
+
119
+ .circle {
120
+ background-image: linear-gradient(var(--light-y), var(--dark-y));
121
+ clip-path: circle(50% at 50% 50%);
122
+ height: var(--shape-height, #{$default-circle-height});
123
+ opacity: $default-shapes-opacity;
124
+ width: var(--shape-height, #{$default-circle-height});
125
+ }
126
+
127
+ .half-circle {
128
+ background: linear-gradient(var(--light-y) 30%, var(--dark-y) 100%);
129
+ clip-path: circle(50% at 50% 100%);
130
+ height: var(--shape-height, #{$default-circle-height});
131
+ opacity: $default-shapes-opacity;
132
+ width: calc(var(--shape-height, #{$default-circle-height}) * 2);
133
+ }
134
+
135
+ .ellipses {
136
+ height: var(--shape-height, #{$default-ellipse-height});
137
+ opacity: $default-shapes-opacity;
138
+ position: relative;
139
+ width: var(--shape-height, #{$default-ellipse-height});
140
+
141
+ .first {
142
+ background-image: linear-gradient(to top, var(--dark-y), var(--y), var(--light-y) 50%, transparent);
143
+ clip-path: ellipse(50% 20% at 50% 60%);
144
+ height: 100%;
145
+ position: absolute;
146
+ width: 100%;
147
+ z-index: 1;
148
+ }
149
+
150
+ .second {
151
+ background-image: linear-gradient(to bottom,var(--dark-y), var(--y), var(--light-y) 45%, transparent);
152
+ clip-path: ellipse(50% 20% at 50% 40%);
153
+ height: 100%;
154
+ position: absolute;
155
+ width: 100%;
156
+ }
157
+ }
158
+
159
+ .spiral {
160
+ height: var(--shape-height, #{$default-ellipse-height});
161
+ width: var(--shape-height, #{$default-ellipse-height});
162
+ opacity: $default-shapes-opacity;
163
+ position: relative;
164
+ display: flex;
165
+ justify-content: center;
166
+ align-items: center;
167
+
168
+ > * {
169
+ border-radius: 50%;
170
+ background: radial-gradient(ellipse at center bottom ,var(--dark-y) 10%, transparent 60%);
171
+ position: absolute;
172
+ opacity: .5;
173
+ }
174
+
175
+ .circle-one {
176
+ transform: rotate(45deg);
177
+ height:calc(var(--shape-height, #{$default-ellipse-height})* 0.4);
178
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 0.4);
179
+ }
180
+
181
+ .circle-two {
182
+ height: calc(var(--shape-height, #{$default-ellipse-height})* 0.6);
183
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 0.6);
184
+ }
185
+
186
+ .circle-three {
187
+ transform: rotate(-45deg);
188
+ height: calc(var(--shape-height, #{$default-ellipse-height})* 0.8);
189
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 0.8);
190
+ }
191
+
192
+ .circle-four {
193
+ transform: rotate(-90deg);
194
+ height: calc(var(--shape-height, #{$default-ellipse-height})* 1);
195
+ width: calc(var(--shape-height, #{$default-ellipse-height})* 1);
196
+ }
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;
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
+ }
221
+ }
package/src/ui/a/index.js CHANGED
@@ -23,3 +23,5 @@ export { Quote } from './Quote'
23
23
  export { ContentCard } from './ContentCard'
24
24
  export { DotInfo } from './DotInfo'
25
25
  export { Timestamp } from './Timestamp'
26
+ export { Shapes } from './Shapes'
27
+ export { OvalIllustration } from './OvalIllustration'
@@ -3,9 +3,10 @@ import * as React from 'react'
3
3
  import PropTypes from 'prop-types'
4
4
  import styleNames from '@pareto-engineering/bem'
5
5
 
6
+ // Local Definitions
7
+ import { Shapes } from 'ui/a'
6
8
  import usePage from '../../usePage'
7
9
 
8
- // Local Definitions
9
10
  const baseClassName = styleNames.base
10
11
  const componentClassName = 'section'
11
12
 
@@ -14,6 +15,11 @@ const Section = ({
14
15
  className:userClassName,
15
16
  style,
16
17
  children,
18
+ backgroundShape,
19
+ backgroundVerticalAlign,
20
+ backgroundHorizontalAlign,
21
+ backgroundHeight,
22
+ backgroundOverflow,
17
23
  ...otherProps
18
24
  }) => {
19
25
  const {
@@ -21,7 +27,6 @@ const Section = ({
21
27
  } = usePage()
22
28
 
23
29
  const sectionId = userId && `${pageId}_${userId}`
24
-
25
30
  return (
26
31
  <section
27
32
  id={sectionId}
@@ -36,6 +41,15 @@ const Section = ({
36
41
  {...otherProps}
37
42
  >
38
43
  {children}
44
+ {backgroundShape && (
45
+ <Shapes
46
+ verticalAlign={backgroundVerticalAlign}
47
+ horizontalAlign={backgroundHorizontalAlign}
48
+ backgroundOverflow={backgroundOverflow}
49
+ height={backgroundHeight}
50
+ shape={backgroundShape}
51
+ />
52
+ )}
39
53
  </section>
40
54
  )
41
55
  }
@@ -60,6 +74,41 @@ Section.propTypes = {
60
74
  * The children JSX
61
75
  */
62
76
  children:PropTypes.node,
77
+
78
+ /**
79
+ * The background shape to use for this section.
80
+ */
81
+ backgroundShape:PropTypes.oneOf([
82
+ 'triangle',
83
+ 'ellipse',
84
+ 'half-ellipse',
85
+ 'half-ellipses',
86
+ 'spiral',
87
+ 'diamonds',
88
+ 'circle',
89
+ 'half-circle',
90
+ 'ellipses',
91
+ 'rectangles',
92
+ ]),
93
+
94
+ /**
95
+ * The background vertical alingment to use for if the background shape is set.
96
+ */
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']),
102
+
103
+ /**
104
+ * The background height to use for if the background shape is set.
105
+ */
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']),
63
112
  }
64
113
 
65
114
  Section.defaultProps = {