@arcblock/ux 1.16.45 → 1.16.46
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/Center/index.js +30 -4
- package/package.json +4 -4
- package/src/Center/index.js +26 -3
package/lib/Center/index.js
CHANGED
|
@@ -9,17 +9,43 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
11
|
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {string} relative 容器相对尺寸,默认相对屏幕(screen),可设置为父容器(parent)
|
|
19
|
+
* @returns react component element
|
|
20
|
+
*/
|
|
15
21
|
function Center(_ref) {
|
|
16
22
|
let {
|
|
17
|
-
children
|
|
23
|
+
children,
|
|
24
|
+
relative
|
|
18
25
|
} = _ref;
|
|
19
|
-
|
|
26
|
+
let style = {};
|
|
27
|
+
|
|
28
|
+
if (relative === 'parent') {
|
|
29
|
+
style = {
|
|
30
|
+
width: '100%',
|
|
31
|
+
height: '100%'
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(Div, {
|
|
36
|
+
style: style
|
|
37
|
+
}, children);
|
|
20
38
|
}
|
|
21
39
|
|
|
22
40
|
const Div = _styledComponents.default.div.withConfig({
|
|
23
41
|
displayName: "Center__Div",
|
|
24
42
|
componentId: "sc-1kmxe8v-0"
|
|
25
|
-
})(["flex:1;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;"]);
|
|
43
|
+
})(["flex:1;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;"]);
|
|
44
|
+
|
|
45
|
+
Center.propTypes = {
|
|
46
|
+
children: _propTypes.default.any.isRequired,
|
|
47
|
+
relative: _propTypes.default.string
|
|
48
|
+
};
|
|
49
|
+
Center.defaultProps = {
|
|
50
|
+
relative: 'screen'
|
|
51
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.46",
|
|
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": "3497b898dbf6619de6ae65656cb00609ff95567c",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@arcblock/icons": "^1.16.
|
|
59
|
-
"@arcblock/react-hooks": "^1.16.
|
|
58
|
+
"@arcblock/icons": "^1.16.46",
|
|
59
|
+
"@arcblock/react-hooks": "^1.16.46",
|
|
60
60
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
61
61
|
"@fontsource/lato": "^4.5.3",
|
|
62
62
|
"@material-ui/core": "^4.12.3",
|
package/src/Center/index.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {string} relative 容器相对尺寸,默认相对屏幕(screen),可设置为父容器(parent)
|
|
8
|
+
* @returns react component element
|
|
9
|
+
*/
|
|
10
|
+
export default function Center({ children, relative }) {
|
|
11
|
+
let style = {};
|
|
12
|
+
|
|
13
|
+
if (relative === 'parent') {
|
|
14
|
+
style = {
|
|
15
|
+
width: '100%',
|
|
16
|
+
height: '100%',
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return <Div style={style}>{children}</Div>;
|
|
7
21
|
}
|
|
8
22
|
|
|
9
23
|
const Div = styled.div`
|
|
@@ -15,3 +29,12 @@ const Div = styled.div`
|
|
|
15
29
|
justify-content: center;
|
|
16
30
|
align-items: center;
|
|
17
31
|
`;
|
|
32
|
+
|
|
33
|
+
Center.propTypes = {
|
|
34
|
+
children: PropTypes.any.isRequired,
|
|
35
|
+
relative: PropTypes.string,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
Center.defaultProps = {
|
|
39
|
+
relative: 'screen',
|
|
40
|
+
};
|