@micromag/element-urbania-author 0.3.58
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/assets/css/styles.css +2 -0
- package/es/index.js +138 -0
- package/lib/index.js +147 -0
- package/package.json +64 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.micromag-element-urbania-author-avatar-container{display:inline-block;position:relative;z-index:1;width:100%}.micromag-element-urbania-author-avatar-container .micromag-element-urbania-author-avatar-shape{display:block;width:100%;height:0;padding-bottom:100%;background-color:#222;background-repeat:no-repeat;background-position:50%;background-size:cover;-webkit-box-shadow:0 0 4px rgba(0,0,0,.2);box-shadow:0 0 4px rgba(0,0,0,.2)}.micromag-element-urbania-author-avatar-container.micromag-element-urbania-author-avatar-shapeCircle .micromag-element-urbania-author-avatar-shape{overflow:hidden;border-radius:50%;background-color:rgba(0,0,0,0);background-position:top}
|
|
2
|
+
.micromag-element-urbania-author-container{display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-ms-flex-align:center;align-items:center;color:#222;font-family:Agrandir;font-size:12px}.micromag-element-urbania-author-container .micromag-element-urbania-author-avatar{min-width:3em;max-width:60px}.micromag-element-urbania-author-container .micromag-element-urbania-author-conjunction{background-color:#e9e9e9;white-space:nowrap}.micromag-element-urbania-author-container .micromag-element-urbania-author-name{margin-left:-6px;padding:6px 8px 4px 13px;border-top-right-radius:10px;border-bottom-right-radius:10px;font-size:13px;font-weight:700;text-transform:uppercase}.micromag-element-urbania-author-container .micromag-element-urbania-author-by{margin-right:-5px;padding:6px 13px 5px 8px;border-top-left-radius:10px;border-bottom-left-radius:10px}.micromag-element-urbania-author-container .micromag-element-urbania-author-by,.micromag-element-urbania-author-container .micromag-element-urbania-author-name{background-color:#e9e9e9;white-space:nowrap}.micromag-element-urbania-author-container.micromag-element-urbania-author-isSmall{font-size:10px}.micromag-element-urbania-author-container.micromag-element-urbania-author-isSmall .micromag-element-urbania-author-name{white-space:normal}
|
package/es/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes$1 from 'prop-types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import { PropTypes } from '@micromag/core';
|
|
7
|
+
import { getOptimalImageUrl } from '@micromag/core/utils';
|
|
8
|
+
|
|
9
|
+
var styles$1 = {"container":"micromag-element-urbania-author-avatar-container","shape":"micromag-element-urbania-author-avatar-shape","shapeCircle":"micromag-element-urbania-author-avatar-shapeCircle"};
|
|
10
|
+
|
|
11
|
+
var propTypes$1 = {
|
|
12
|
+
image: PropTypes.imageElement,
|
|
13
|
+
width: PropTypes$1.number,
|
|
14
|
+
height: PropTypes$1.number,
|
|
15
|
+
isTag: PropTypes$1.bool,
|
|
16
|
+
shape: PropTypes$1.oneOf([null, 'tag', 'circle']),
|
|
17
|
+
className: PropTypes$1.string
|
|
18
|
+
};
|
|
19
|
+
var defaultProps$1 = {
|
|
20
|
+
image: null,
|
|
21
|
+
width: 100,
|
|
22
|
+
height: 100,
|
|
23
|
+
isTag: false,
|
|
24
|
+
shape: 'Circle',
|
|
25
|
+
className: null
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var Avatar = function Avatar(_ref) {
|
|
29
|
+
var _ref2;
|
|
30
|
+
|
|
31
|
+
var image = _ref.image,
|
|
32
|
+
width = _ref.width,
|
|
33
|
+
height = _ref.height,
|
|
34
|
+
shape = _ref.shape,
|
|
35
|
+
isTag = _ref.isTag,
|
|
36
|
+
className = _ref.className;
|
|
37
|
+
var imageAtSize = getOptimalImageUrl(image, width, height);
|
|
38
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
39
|
+
className: classNames([styles$1.container, (_ref2 = {}, _defineProperty(_ref2, styles$1["shape".concat(shape)], shape !== null), _defineProperty(_ref2, styles$1.isTag, isTag), _defineProperty(_ref2, className, className !== null), _ref2)])
|
|
40
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
41
|
+
className: styles$1.shape,
|
|
42
|
+
style: {
|
|
43
|
+
backgroundImage: "url(\"".concat(imageAtSize, "\")")
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
Avatar.propTypes = propTypes$1;
|
|
49
|
+
Avatar.defaultProps = defaultProps$1;
|
|
50
|
+
|
|
51
|
+
var styles = {"container":"micromag-element-urbania-author-container","avatar":"micromag-element-urbania-author-avatar","conjunction":"micromag-element-urbania-author-conjunction","name":"micromag-element-urbania-author-name","by":"micromag-element-urbania-author-by","isSmall":"micromag-element-urbania-author-isSmall"};
|
|
52
|
+
|
|
53
|
+
var propTypes = {
|
|
54
|
+
author: PropTypes$1.shape({
|
|
55
|
+
slug: PropTypes$1.string,
|
|
56
|
+
name: PropTypes$1.string,
|
|
57
|
+
avatar: PropTypes.imageElement,
|
|
58
|
+
url: PropTypes$1.string
|
|
59
|
+
}),
|
|
60
|
+
withAvatar: PropTypes$1.bool,
|
|
61
|
+
withConjunction: PropTypes$1.bool,
|
|
62
|
+
withoutLink: PropTypes$1.bool,
|
|
63
|
+
isSmall: PropTypes$1.bool,
|
|
64
|
+
linkUnderlineColor: PropTypes$1.string,
|
|
65
|
+
className: PropTypes$1.string
|
|
66
|
+
};
|
|
67
|
+
var defaultProps = {
|
|
68
|
+
author: null,
|
|
69
|
+
withAvatar: true,
|
|
70
|
+
withConjunction: false,
|
|
71
|
+
withoutLink: false,
|
|
72
|
+
isSmall: false,
|
|
73
|
+
linkUnderlineColor: null,
|
|
74
|
+
className: null
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var UrbaniaAuthor = function UrbaniaAuthor(_ref) {
|
|
78
|
+
var _ref3;
|
|
79
|
+
|
|
80
|
+
var author = _ref.author,
|
|
81
|
+
withAvatar = _ref.withAvatar,
|
|
82
|
+
withConjunction = _ref.withConjunction,
|
|
83
|
+
withoutLink = _ref.withoutLink,
|
|
84
|
+
isSmall = _ref.isSmall,
|
|
85
|
+
linkUnderlineColor = _ref.linkUnderlineColor,
|
|
86
|
+
className = _ref.className;
|
|
87
|
+
|
|
88
|
+
var _ref2 = author || {},
|
|
89
|
+
_ref2$name = _ref2.name,
|
|
90
|
+
name = _ref2$name === void 0 ? '' : _ref2$name,
|
|
91
|
+
_ref2$avatar = _ref2.avatar,
|
|
92
|
+
avatar = _ref2$avatar === void 0 ? null : _ref2$avatar,
|
|
93
|
+
_ref2$url = _ref2.url,
|
|
94
|
+
url = _ref2$url === void 0 ? null : _ref2$url;
|
|
95
|
+
|
|
96
|
+
var prefix = /*#__PURE__*/React.createElement("span", {
|
|
97
|
+
className: styles.by
|
|
98
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
99
|
+
id: "jEK6B8",
|
|
100
|
+
defaultMessage: [{
|
|
101
|
+
"type": 0,
|
|
102
|
+
"value": "By"
|
|
103
|
+
}]
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
if (withConjunction) {
|
|
107
|
+
prefix = /*#__PURE__*/React.createElement("span", {
|
|
108
|
+
className: styles.conjunction
|
|
109
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
110
|
+
id: "0UxdOa",
|
|
111
|
+
defaultMessage: [{
|
|
112
|
+
"type": 0,
|
|
113
|
+
"value": "and"
|
|
114
|
+
}]
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: classNames([styles.container, (_ref3 = {}, _defineProperty(_ref3, styles.isSmall, isSmall), _defineProperty(_ref3, className, className !== null), _ref3)])
|
|
120
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
121
|
+
className: styles.prefix
|
|
122
|
+
}, prefix), withAvatar && avatar !== null ? /*#__PURE__*/React.createElement(Avatar, {
|
|
123
|
+
className: styles.avatar,
|
|
124
|
+
image: avatar
|
|
125
|
+
}) : null, url !== null && !withoutLink ? /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
className: styles.name,
|
|
127
|
+
style: {
|
|
128
|
+
backgroundImage: linkUnderlineColor !== null ? "linear-gradient(0deg, ".concat(linkUnderlineColor, " 0, ").concat(linkUnderlineColor, ")") : null
|
|
129
|
+
}
|
|
130
|
+
}, name) : /*#__PURE__*/React.createElement("em", {
|
|
131
|
+
className: styles.name
|
|
132
|
+
}, name));
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
UrbaniaAuthor.propTypes = propTypes;
|
|
136
|
+
UrbaniaAuthor.defaultProps = defaultProps;
|
|
137
|
+
|
|
138
|
+
export { UrbaniaAuthor as default };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var classNames = require('classnames');
|
|
5
|
+
var PropTypes = require('prop-types');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var reactIntl = require('react-intl');
|
|
8
|
+
var core = require('@micromag/core');
|
|
9
|
+
var utils = require('@micromag/core/utils');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
14
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
15
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
+
|
|
18
|
+
var styles$1 = {"container":"micromag-element-urbania-author-avatar-container","shape":"micromag-element-urbania-author-avatar-shape","shapeCircle":"micromag-element-urbania-author-avatar-shapeCircle"};
|
|
19
|
+
|
|
20
|
+
var propTypes$1 = {
|
|
21
|
+
image: core.PropTypes.imageElement,
|
|
22
|
+
width: PropTypes__default["default"].number,
|
|
23
|
+
height: PropTypes__default["default"].number,
|
|
24
|
+
isTag: PropTypes__default["default"].bool,
|
|
25
|
+
shape: PropTypes__default["default"].oneOf([null, 'tag', 'circle']),
|
|
26
|
+
className: PropTypes__default["default"].string
|
|
27
|
+
};
|
|
28
|
+
var defaultProps$1 = {
|
|
29
|
+
image: null,
|
|
30
|
+
width: 100,
|
|
31
|
+
height: 100,
|
|
32
|
+
isTag: false,
|
|
33
|
+
shape: 'Circle',
|
|
34
|
+
className: null
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var Avatar = function Avatar(_ref) {
|
|
38
|
+
var _ref2;
|
|
39
|
+
|
|
40
|
+
var image = _ref.image,
|
|
41
|
+
width = _ref.width,
|
|
42
|
+
height = _ref.height,
|
|
43
|
+
shape = _ref.shape,
|
|
44
|
+
isTag = _ref.isTag,
|
|
45
|
+
className = _ref.className;
|
|
46
|
+
var imageAtSize = utils.getOptimalImageUrl(image, width, height);
|
|
47
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
48
|
+
className: classNames__default["default"]([styles$1.container, (_ref2 = {}, _defineProperty__default["default"](_ref2, styles$1["shape".concat(shape)], shape !== null), _defineProperty__default["default"](_ref2, styles$1.isTag, isTag), _defineProperty__default["default"](_ref2, className, className !== null), _ref2)])
|
|
49
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
50
|
+
className: styles$1.shape,
|
|
51
|
+
style: {
|
|
52
|
+
backgroundImage: "url(\"".concat(imageAtSize, "\")")
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
Avatar.propTypes = propTypes$1;
|
|
58
|
+
Avatar.defaultProps = defaultProps$1;
|
|
59
|
+
|
|
60
|
+
var styles = {"container":"micromag-element-urbania-author-container","avatar":"micromag-element-urbania-author-avatar","conjunction":"micromag-element-urbania-author-conjunction","name":"micromag-element-urbania-author-name","by":"micromag-element-urbania-author-by","isSmall":"micromag-element-urbania-author-isSmall"};
|
|
61
|
+
|
|
62
|
+
var propTypes = {
|
|
63
|
+
author: PropTypes__default["default"].shape({
|
|
64
|
+
slug: PropTypes__default["default"].string,
|
|
65
|
+
name: PropTypes__default["default"].string,
|
|
66
|
+
avatar: core.PropTypes.imageElement,
|
|
67
|
+
url: PropTypes__default["default"].string
|
|
68
|
+
}),
|
|
69
|
+
withAvatar: PropTypes__default["default"].bool,
|
|
70
|
+
withConjunction: PropTypes__default["default"].bool,
|
|
71
|
+
withoutLink: PropTypes__default["default"].bool,
|
|
72
|
+
isSmall: PropTypes__default["default"].bool,
|
|
73
|
+
linkUnderlineColor: PropTypes__default["default"].string,
|
|
74
|
+
className: PropTypes__default["default"].string
|
|
75
|
+
};
|
|
76
|
+
var defaultProps = {
|
|
77
|
+
author: null,
|
|
78
|
+
withAvatar: true,
|
|
79
|
+
withConjunction: false,
|
|
80
|
+
withoutLink: false,
|
|
81
|
+
isSmall: false,
|
|
82
|
+
linkUnderlineColor: null,
|
|
83
|
+
className: null
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var UrbaniaAuthor = function UrbaniaAuthor(_ref) {
|
|
87
|
+
var _ref3;
|
|
88
|
+
|
|
89
|
+
var author = _ref.author,
|
|
90
|
+
withAvatar = _ref.withAvatar,
|
|
91
|
+
withConjunction = _ref.withConjunction,
|
|
92
|
+
withoutLink = _ref.withoutLink,
|
|
93
|
+
isSmall = _ref.isSmall,
|
|
94
|
+
linkUnderlineColor = _ref.linkUnderlineColor,
|
|
95
|
+
className = _ref.className;
|
|
96
|
+
|
|
97
|
+
var _ref2 = author || {},
|
|
98
|
+
_ref2$name = _ref2.name,
|
|
99
|
+
name = _ref2$name === void 0 ? '' : _ref2$name,
|
|
100
|
+
_ref2$avatar = _ref2.avatar,
|
|
101
|
+
avatar = _ref2$avatar === void 0 ? null : _ref2$avatar,
|
|
102
|
+
_ref2$url = _ref2.url,
|
|
103
|
+
url = _ref2$url === void 0 ? null : _ref2$url;
|
|
104
|
+
|
|
105
|
+
var prefix = /*#__PURE__*/React__default["default"].createElement("span", {
|
|
106
|
+
className: styles.by
|
|
107
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
108
|
+
id: "jEK6B8",
|
|
109
|
+
defaultMessage: [{
|
|
110
|
+
"type": 0,
|
|
111
|
+
"value": "By"
|
|
112
|
+
}]
|
|
113
|
+
}));
|
|
114
|
+
|
|
115
|
+
if (withConjunction) {
|
|
116
|
+
prefix = /*#__PURE__*/React__default["default"].createElement("span", {
|
|
117
|
+
className: styles.conjunction
|
|
118
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
119
|
+
id: "0UxdOa",
|
|
120
|
+
defaultMessage: [{
|
|
121
|
+
"type": 0,
|
|
122
|
+
"value": "and"
|
|
123
|
+
}]
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
128
|
+
className: classNames__default["default"]([styles.container, (_ref3 = {}, _defineProperty__default["default"](_ref3, styles.isSmall, isSmall), _defineProperty__default["default"](_ref3, className, className !== null), _ref3)])
|
|
129
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
130
|
+
className: styles.prefix
|
|
131
|
+
}, prefix), withAvatar && avatar !== null ? /*#__PURE__*/React__default["default"].createElement(Avatar, {
|
|
132
|
+
className: styles.avatar,
|
|
133
|
+
image: avatar
|
|
134
|
+
}) : null, url !== null && !withoutLink ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
135
|
+
className: styles.name,
|
|
136
|
+
style: {
|
|
137
|
+
backgroundImage: linkUnderlineColor !== null ? "linear-gradient(0deg, ".concat(linkUnderlineColor, " 0, ").concat(linkUnderlineColor, ")") : null
|
|
138
|
+
}
|
|
139
|
+
}, name) : /*#__PURE__*/React__default["default"].createElement("em", {
|
|
140
|
+
className: styles.name
|
|
141
|
+
}, name));
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
UrbaniaAuthor.propTypes = propTypes;
|
|
145
|
+
UrbaniaAuthor.defaultProps = defaultProps;
|
|
146
|
+
|
|
147
|
+
module.exports = UrbaniaAuthor;
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@micromag/element-urbania-author",
|
|
3
|
+
"version": "0.3.58",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"javascript"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/urbania-media/micromag-js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/urbania-media/micromag-js.git"
|
|
12
|
+
},
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "Folklore",
|
|
15
|
+
"email": "info@folklore.email"
|
|
16
|
+
},
|
|
17
|
+
"contributors": [
|
|
18
|
+
{
|
|
19
|
+
"name": "David Mongeau-Petitpas",
|
|
20
|
+
"email": "dmp@folklore.email"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Nicolas Roy-Bourdages",
|
|
24
|
+
"email": "nrb@folklore.email"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "Joseph Blais",
|
|
28
|
+
"email": "joseph@folklore.email"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"main": "lib/index.js",
|
|
33
|
+
"module": "es/index.js",
|
|
34
|
+
"files": [
|
|
35
|
+
"lib",
|
|
36
|
+
"es",
|
|
37
|
+
"assets"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"prepare": "../../scripts/prepare-package.sh"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"react": "^16.8.0 || ^17.0.0",
|
|
44
|
+
"react-dom": "^16.8.0 || ^17.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": "^16.8.0 || ^17.0.0",
|
|
48
|
+
"react-dom": "^16.8.0 || ^17.0.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@babel/runtime": "^7.13.10",
|
|
52
|
+
"@micromag/core": "^0.3.58",
|
|
53
|
+
"@micromag/element-button": "^0.3.58",
|
|
54
|
+
"classnames": "^2.2.6",
|
|
55
|
+
"lodash": "^4.17.21",
|
|
56
|
+
"prop-types": "^15.7.2",
|
|
57
|
+
"react-intl": "^5.12.1",
|
|
58
|
+
"uuid": "^8.3.2"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "80fc5af53d50e031d2516967d52ca61e789d52de"
|
|
64
|
+
}
|