@arcblock/ux 1.16.4 → 1.16.5
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/lib/Blocklet/index.js +17 -4
- package/lib/CodeBlock/index.js +2 -2
- package/package.json +4 -4
- package/src/Blocklet/index.js +14 -1
- package/src/CodeBlock/index.js +1 -1
package/lib/Blocklet/index.js
CHANGED
|
@@ -21,13 +21,15 @@ var _useMediaQuery = _interopRequireDefault(require("@material-ui/core/useMediaQ
|
|
|
21
21
|
|
|
22
22
|
var _useTheme = _interopRequireDefault(require("@material-ui/core/styles/useTheme"));
|
|
23
23
|
|
|
24
|
+
var _Avatar = _interopRequireDefault(require("@arcblock/did-connect/lib/Avatar"));
|
|
25
|
+
|
|
24
26
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
25
27
|
|
|
26
28
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
27
29
|
|
|
28
30
|
var _Img = _interopRequireDefault(require("../Img"));
|
|
29
31
|
|
|
30
|
-
const _excluded = ["title", "description", "cover", "type", "size", "addons", "button", "buttonText", "buttonDisabled", "buttonLoading", "isStickyButton", "onButtonClick", "onMainClick", "onTagClick", "className", "scaleClickZone"];
|
|
32
|
+
const _excluded = ["title", "did", "description", "cover", "type", "size", "addons", "button", "buttonText", "buttonDisabled", "buttonLoading", "isStickyButton", "onButtonClick", "onMainClick", "onTagClick", "className", "scaleClickZone"];
|
|
31
33
|
|
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
35
|
|
|
@@ -78,6 +80,7 @@ function prettySize(_size) {
|
|
|
78
80
|
function Blocklet(_ref2) {
|
|
79
81
|
let {
|
|
80
82
|
title,
|
|
83
|
+
did,
|
|
81
84
|
description,
|
|
82
85
|
cover,
|
|
83
86
|
type,
|
|
@@ -128,10 +131,13 @@ function Blocklet(_ref2) {
|
|
|
128
131
|
|
|
129
132
|
const theme = (0, _useTheme.default)();
|
|
130
133
|
const isDownSm = (0, _useMediaQuery.default)(theme.breakpoints.down('sm'));
|
|
131
|
-
const isDownMd = (0, _useMediaQuery.default)(theme.breakpoints.down('md'));
|
|
134
|
+
const isDownMd = (0, _useMediaQuery.default)(theme.breakpoints.down('md'));
|
|
135
|
+
const isUPLg = (0, _useMediaQuery.default)(theme.breakpoints.up('lg')); // If size is auto, need calculate actual size according to screen size
|
|
132
136
|
// eslint-disable-next-line no-nested-ternary
|
|
133
137
|
|
|
134
|
-
const actualSize = size === 'auto' ? isDownSm ? 'xs' : isDownMd ? 'sm' : 'md' : size;
|
|
138
|
+
const actualSize = size === 'auto' ? isDownSm ? 'xs' : isDownMd ? 'sm' : 'md' : size; // eslint-disable-next-line no-nested-ternary
|
|
139
|
+
|
|
140
|
+
const didAvatarSize = size === 'auto' ? isUPLg ? 100 : 48 : size === 'md' ? 100 : 48;
|
|
135
141
|
const container = (0, _react.useRef)(null);
|
|
136
142
|
return /*#__PURE__*/_react.default.createElement(Div, Object.assign({}, rest, {
|
|
137
143
|
scaleClickZone: scaleClickZone,
|
|
@@ -144,10 +150,15 @@ function Blocklet(_ref2) {
|
|
|
144
150
|
ref: container
|
|
145
151
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
146
152
|
className: "arcblock-blocklet__content--body"
|
|
147
|
-
}, cover
|
|
153
|
+
}, cover ? /*#__PURE__*/_react.default.createElement("div", {
|
|
148
154
|
className: "arcblock-blocklet__cover"
|
|
149
155
|
}, /*#__PURE__*/_react.default.createElement(_Img.default, {
|
|
150
156
|
src: cover
|
|
157
|
+
})) : did && /*#__PURE__*/_react.default.createElement("div", {
|
|
158
|
+
className: "arcblock-blocklet__cover"
|
|
159
|
+
}, /*#__PURE__*/_react.default.createElement(_Avatar.default, {
|
|
160
|
+
did: did,
|
|
161
|
+
size: didAvatarSize
|
|
151
162
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
152
163
|
className: "arcblock-blocklet__info"
|
|
153
164
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
@@ -205,6 +216,7 @@ function Blocklet(_ref2) {
|
|
|
205
216
|
|
|
206
217
|
Blocklet.propTypes = {
|
|
207
218
|
title: _propTypes.default.string.isRequired,
|
|
219
|
+
did: _propTypes.default.string,
|
|
208
220
|
isStickyButton: _propTypes.default.bool,
|
|
209
221
|
description: _propTypes.default.string,
|
|
210
222
|
cover: _propTypes.default.string,
|
|
@@ -224,6 +236,7 @@ Blocklet.propTypes = {
|
|
|
224
236
|
Blocklet.defaultProps = {
|
|
225
237
|
description: null,
|
|
226
238
|
cover: null,
|
|
239
|
+
did: null,
|
|
227
240
|
isStickyButton: false,
|
|
228
241
|
buttonText: 'Install',
|
|
229
242
|
buttonDisabled: false,
|
package/lib/CodeBlock/index.js
CHANGED
|
@@ -15,8 +15,6 @@ var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard"));
|
|
|
15
15
|
|
|
16
16
|
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
17
17
|
|
|
18
|
-
var _Colors = _interopRequireDefault(require("@arcblock/ux/lib/Colors"));
|
|
19
|
-
|
|
20
18
|
var _useMountedState = _interopRequireDefault(require("react-use/lib/useMountedState"));
|
|
21
19
|
|
|
22
20
|
var _highlight = _interopRequireDefault(require("highlight.js/lib/highlight"));
|
|
@@ -53,6 +51,8 @@ var _FileCopy = _interopRequireDefault(require("@material-ui/icons/FileCopy"));
|
|
|
53
51
|
|
|
54
52
|
var _Check = _interopRequireDefault(require("@material-ui/icons/Check"));
|
|
55
53
|
|
|
54
|
+
var _Colors = _interopRequireDefault(require("../Colors"));
|
|
55
|
+
|
|
56
56
|
const _excluded = ["code", "language", "children"];
|
|
57
57
|
|
|
58
58
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.5",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"react": ">=16.12.0",
|
|
54
54
|
"react-ga": "^2.7.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "15f756e061f6cf2f8bbaea06ffaed0bff3b3ed33",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@arcblock/icons": "^1.16.
|
|
59
|
-
"@arcblock/react-hooks": "^1.16.
|
|
58
|
+
"@arcblock/icons": "^1.16.5",
|
|
59
|
+
"@arcblock/react-hooks": "^1.16.5",
|
|
60
60
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
61
61
|
"@material-ui/core": "^4.12.3",
|
|
62
62
|
"@material-ui/icons": "4.11.2",
|
package/src/Blocklet/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import Typography from '@material-ui/core/Typography';
|
|
|
6
6
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
7
7
|
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
8
8
|
import useTheme from '@material-ui/core/styles/useTheme';
|
|
9
|
+
import Avatar from '@arcblock/did-connect/lib/Avatar';
|
|
9
10
|
|
|
10
11
|
import Icon from '../Icon';
|
|
11
12
|
import Button from '../Button';
|
|
@@ -163,6 +164,7 @@ function prettySize(_size) {
|
|
|
163
164
|
|
|
164
165
|
export default function Blocklet({
|
|
165
166
|
title,
|
|
167
|
+
did,
|
|
166
168
|
description,
|
|
167
169
|
cover,
|
|
168
170
|
type,
|
|
@@ -204,10 +206,13 @@ export default function Blocklet({
|
|
|
204
206
|
const theme = useTheme();
|
|
205
207
|
const isDownSm = useMediaQuery(theme.breakpoints.down('sm'));
|
|
206
208
|
const isDownMd = useMediaQuery(theme.breakpoints.down('md'));
|
|
209
|
+
const isUPLg = useMediaQuery(theme.breakpoints.up('lg'));
|
|
207
210
|
|
|
208
211
|
// If size is auto, need calculate actual size according to screen size
|
|
209
212
|
// eslint-disable-next-line no-nested-ternary
|
|
210
213
|
const actualSize = size === 'auto' ? (isDownSm ? 'xs' : isDownMd ? 'sm' : 'md') : size;
|
|
214
|
+
// eslint-disable-next-line no-nested-ternary
|
|
215
|
+
const didAvatarSize = size === 'auto' ? (isUPLg ? 100 : 48) : size === 'md' ? 100 : 48;
|
|
211
216
|
const container = useRef(null);
|
|
212
217
|
|
|
213
218
|
return (
|
|
@@ -218,10 +223,16 @@ export default function Blocklet({
|
|
|
218
223
|
<div className="arcblock-blocklet__content">
|
|
219
224
|
<div className="arcblock-blocklet__content--main" onClick={_onMainClick} ref={container}>
|
|
220
225
|
<div className="arcblock-blocklet__content--body">
|
|
221
|
-
{cover
|
|
226
|
+
{cover ? (
|
|
222
227
|
<div className="arcblock-blocklet__cover">
|
|
223
228
|
<Img src={cover} />
|
|
224
229
|
</div>
|
|
230
|
+
) : (
|
|
231
|
+
did && (
|
|
232
|
+
<div className="arcblock-blocklet__cover">
|
|
233
|
+
<Avatar did={did} size={didAvatarSize} />
|
|
234
|
+
</div>
|
|
235
|
+
)
|
|
225
236
|
)}
|
|
226
237
|
<div className="arcblock-blocklet__info">
|
|
227
238
|
<Typography
|
|
@@ -299,6 +310,7 @@ export default function Blocklet({
|
|
|
299
310
|
|
|
300
311
|
Blocklet.propTypes = {
|
|
301
312
|
title: PropTypes.string.isRequired,
|
|
313
|
+
did: PropTypes.string,
|
|
302
314
|
isStickyButton: PropTypes.bool,
|
|
303
315
|
description: PropTypes.string,
|
|
304
316
|
cover: PropTypes.string,
|
|
@@ -319,6 +331,7 @@ Blocklet.propTypes = {
|
|
|
319
331
|
Blocklet.defaultProps = {
|
|
320
332
|
description: null,
|
|
321
333
|
cover: null,
|
|
334
|
+
did: null,
|
|
322
335
|
isStickyButton: false,
|
|
323
336
|
buttonText: 'Install',
|
|
324
337
|
buttonDisabled: false,
|
package/src/CodeBlock/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import Copy from 'copy-to-clipboard';
|
|
6
6
|
import Button from '@material-ui/core/IconButton';
|
|
7
|
-
import colors from '@arcblock/ux/lib/Colors';
|
|
8
7
|
import useMountedState from 'react-use/lib/useMountedState';
|
|
9
8
|
|
|
10
9
|
import hljs from 'highlight.js/lib/highlight';
|
|
@@ -26,6 +25,7 @@ import 'highlight.js/styles/atom-one-dark.css';
|
|
|
26
25
|
|
|
27
26
|
import CopyIcon from '@material-ui/icons/FileCopy';
|
|
28
27
|
import CheckIcon from '@material-ui/icons/Check';
|
|
28
|
+
import colors from '../Colors';
|
|
29
29
|
|
|
30
30
|
hljs.registerLanguage('javascript', javascript);
|
|
31
31
|
hljs.registerLanguage('js', javascript);
|