@pareto-engineering/design-system 2.0.0-alpha.6 → 2.0.0-alpha.7
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/index.js +9 -1
- 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/index.js +2 -1
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +33 -0
- package/src/stories/a/OvalIllustration.stories.jsx +36 -0
- 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/index.js +1 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _bem = _interopRequireDefault(require("@pareto-engineering/bem"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
// Local Definitions
|
|
21
|
+
var baseClassName = _bem.default.base;
|
|
22
|
+
var componentClassName = 'oval-illustration';
|
|
23
|
+
/**
|
|
24
|
+
* This is the component description.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var OvalIllustration = _ref => {
|
|
28
|
+
var {
|
|
29
|
+
id,
|
|
30
|
+
className: userClassName,
|
|
31
|
+
style,
|
|
32
|
+
layout,
|
|
33
|
+
src,
|
|
34
|
+
alt,
|
|
35
|
+
ovalBackground,
|
|
36
|
+
backgroundColor // ...otherProps
|
|
37
|
+
|
|
38
|
+
} = _ref;
|
|
39
|
+
(0, React.useLayoutEffect)(() => {
|
|
40
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
41
|
+
}, []);
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
id: id,
|
|
44
|
+
className: [baseClassName, componentClassName, userClassName, layout].filter(e => e).join(' '),
|
|
45
|
+
style: style // {...otherProps}
|
|
46
|
+
|
|
47
|
+
}, ovalBackground && /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "oval-background y-".concat(backgroundColor)
|
|
49
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "illustration"
|
|
51
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
52
|
+
src: src,
|
|
53
|
+
alt: alt
|
|
54
|
+
})));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
OvalIllustration.propTypes = {
|
|
58
|
+
/**
|
|
59
|
+
* The HTML id for this element
|
|
60
|
+
*/
|
|
61
|
+
id: _propTypes.default.string,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The HTML class names for this element
|
|
65
|
+
*/
|
|
66
|
+
className: _propTypes.default.string,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The React-written, css properties for this element.
|
|
70
|
+
*/
|
|
71
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* side definition of the illustration
|
|
75
|
+
*/
|
|
76
|
+
layout: _propTypes.default.oneOf(['left', 'right']),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* image url
|
|
80
|
+
*/
|
|
81
|
+
src: _propTypes.default.string,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* alt tag for the image
|
|
85
|
+
*/
|
|
86
|
+
alt: _propTypes.default.string,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* whether to have a oval shape as background
|
|
90
|
+
*/
|
|
91
|
+
ovalBackground: _propTypes.default.bool,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* background color of the oval behind the image
|
|
95
|
+
*/
|
|
96
|
+
backgroundColor: _propTypes.default.string
|
|
97
|
+
};
|
|
98
|
+
OvalIllustration.defaultProps = {
|
|
99
|
+
layout: 'left'
|
|
100
|
+
};
|
|
101
|
+
var _default = OvalIllustration;
|
|
102
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "OvalIllustration", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _OvalIllustration.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _OvalIllustration = _interopRequireDefault(require("./OvalIllustration"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -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
|
+
}
|
package/dist/cjs/a/index.js
CHANGED
|
@@ -147,6 +147,12 @@ Object.defineProperty(exports, "Shapes", {
|
|
|
147
147
|
return _Shapes.Shapes;
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
|
+
Object.defineProperty(exports, "OvalIllustration", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function get() {
|
|
153
|
+
return _OvalIllustration.OvalIllustration;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
150
156
|
|
|
151
157
|
var _SVG = require("./SVG");
|
|
152
158
|
|
|
@@ -188,4 +194,6 @@ var _DotInfo = require("./DotInfo");
|
|
|
188
194
|
|
|
189
195
|
var _Timestamp = require("./Timestamp");
|
|
190
196
|
|
|
191
|
-
var _Shapes = require("./Shapes");
|
|
197
|
+
var _Shapes = require("./Shapes");
|
|
198
|
+
|
|
199
|
+
var _OvalIllustration = require("./OvalIllustration");
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useLayoutEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
|
+
|
|
7
|
+
const baseClassName = styleNames.base;
|
|
8
|
+
const componentClassName = 'oval-illustration';
|
|
9
|
+
/**
|
|
10
|
+
* This is the component description.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const OvalIllustration = ({
|
|
14
|
+
id,
|
|
15
|
+
className: userClassName,
|
|
16
|
+
style,
|
|
17
|
+
layout,
|
|
18
|
+
src,
|
|
19
|
+
alt,
|
|
20
|
+
ovalBackground,
|
|
21
|
+
backgroundColor // ...otherProps
|
|
22
|
+
|
|
23
|
+
}) => {
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
import("./styles.scss");
|
|
26
|
+
}, []);
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
id: id,
|
|
29
|
+
className: [baseClassName, componentClassName, userClassName, layout].filter(e => e).join(' '),
|
|
30
|
+
style: style // {...otherProps}
|
|
31
|
+
|
|
32
|
+
}, ovalBackground && /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: `oval-background y-${backgroundColor}`
|
|
34
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "illustration"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
37
|
+
src: src,
|
|
38
|
+
alt: alt
|
|
39
|
+
})));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
OvalIllustration.propTypes = {
|
|
43
|
+
/**
|
|
44
|
+
* The HTML id for this element
|
|
45
|
+
*/
|
|
46
|
+
id: PropTypes.string,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The HTML class names for this element
|
|
50
|
+
*/
|
|
51
|
+
className: PropTypes.string,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The React-written, css properties for this element.
|
|
55
|
+
*/
|
|
56
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* side definition of the illustration
|
|
60
|
+
*/
|
|
61
|
+
layout: PropTypes.oneOf(['left', 'right']),
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* image url
|
|
65
|
+
*/
|
|
66
|
+
src: PropTypes.string,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* alt tag for the image
|
|
70
|
+
*/
|
|
71
|
+
alt: PropTypes.string,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* whether to have a oval shape as background
|
|
75
|
+
*/
|
|
76
|
+
ovalBackground: PropTypes.bool,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* background color of the oval behind the image
|
|
80
|
+
*/
|
|
81
|
+
backgroundColor: PropTypes.string
|
|
82
|
+
};
|
|
83
|
+
OvalIllustration.defaultProps = {
|
|
84
|
+
layout: 'left'
|
|
85
|
+
};
|
|
86
|
+
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: -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
|
+
}
|
package/dist/es/a/index.js
CHANGED
|
@@ -18,4 +18,5 @@ export { Quote } from "./Quote";
|
|
|
18
18
|
export { ContentCard } from "./ContentCard";
|
|
19
19
|
export { DotInfo } from "./DotInfo";
|
|
20
20
|
export { Timestamp } from "./Timestamp";
|
|
21
|
-
export { Shapes } from "./Shapes";
|
|
21
|
+
export { Shapes } from "./Shapes";
|
|
22
|
+
export { OvalIllustration } from "./OvalIllustration";
|
package/package.json
CHANGED
|
@@ -783,6 +783,39 @@ exports[`Storyshots a/LoadingCircle Base 1`] = `
|
|
|
783
783
|
</div>
|
|
784
784
|
`;
|
|
785
785
|
|
|
786
|
+
exports[`Storyshots a/OvalIllustration With Background 1`] = `
|
|
787
|
+
<div
|
|
788
|
+
className="base oval-illustration right"
|
|
789
|
+
>
|
|
790
|
+
<div
|
|
791
|
+
className="oval-background y-background3"
|
|
792
|
+
/>
|
|
793
|
+
<div
|
|
794
|
+
className="illustration"
|
|
795
|
+
>
|
|
796
|
+
<img
|
|
797
|
+
alt="illustration"
|
|
798
|
+
src="https://www.azernews.az/media/pictures/company_picture.jpg"
|
|
799
|
+
/>
|
|
800
|
+
</div>
|
|
801
|
+
</div>
|
|
802
|
+
`;
|
|
803
|
+
|
|
804
|
+
exports[`Storyshots a/OvalIllustration Without Background 1`] = `
|
|
805
|
+
<div
|
|
806
|
+
className="base oval-illustration left"
|
|
807
|
+
>
|
|
808
|
+
<div
|
|
809
|
+
className="illustration"
|
|
810
|
+
>
|
|
811
|
+
<img
|
|
812
|
+
alt="illustration"
|
|
813
|
+
src="https://www.azernews.az/media/pictures/company_picture.jpg"
|
|
814
|
+
/>
|
|
815
|
+
</div>
|
|
816
|
+
</div>
|
|
817
|
+
`;
|
|
818
|
+
|
|
786
819
|
exports[`Storyshots a/People Base 1`] = `
|
|
787
820
|
<div
|
|
788
821
|
className="x-background1 b-x v1 p-v"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { OvalIllustration } from 'ui'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title :'a/OvalIllustration',
|
|
8
|
+
component :OvalIllustration,
|
|
9
|
+
subcomponents:{
|
|
10
|
+
// Item:OvalIllustration.Item
|
|
11
|
+
},
|
|
12
|
+
decorators:[
|
|
13
|
+
// storyfn => <div className="">{ storyfn() }</div>,
|
|
14
|
+
],
|
|
15
|
+
argTypes:{
|
|
16
|
+
backgroundColor:{ control: 'color' },
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const WithBackground = () => (
|
|
21
|
+
<OvalIllustration
|
|
22
|
+
backgroundColor="background3"
|
|
23
|
+
src="https://www.azernews.az/media/pictures/company_picture.jpg"
|
|
24
|
+
alt="illustration"
|
|
25
|
+
ovalBackground
|
|
26
|
+
layout="right"
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export const WithoutBackground = () => (
|
|
31
|
+
<OvalIllustration
|
|
32
|
+
src="https://www.azernews.az/media/pictures/company_picture.jpg"
|
|
33
|
+
alt="illustration"
|
|
34
|
+
layout="left"
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
@@ -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: -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
|
+
}
|
package/src/ui/a/index.js
CHANGED