@arcblock/ux 1.16.61 → 1.16.62
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/Layout/dashboard/header.js +15 -2
- package/lib/Layout/dashboard/index.js +2 -2
- package/lib/Layout/dashboard/sidebar.js +1 -1
- package/lib/Layout/index.js +1 -1
- package/package.json +4 -4
- package/src/Layout/dashboard/header.js +14 -14
- package/src/Layout/dashboard/index.js +2 -2
- package/src/Layout/dashboard/sidebar.js +1 -1
- package/src/Layout/index.js +2 -2
|
@@ -21,6 +21,8 @@ var _Box = _interopRequireDefault(require("@material-ui/core/Box"));
|
|
|
21
21
|
|
|
22
22
|
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
23
23
|
|
|
24
|
+
var _Hidden = _interopRequireDefault(require("@material-ui/core/Hidden"));
|
|
25
|
+
|
|
24
26
|
var _Menu = _interopRequireDefault(require("@material-ui/icons/Menu"));
|
|
25
27
|
|
|
26
28
|
var _reactRouterDom = require("react-router-dom");
|
|
@@ -38,7 +40,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
38
40
|
const StyledAppBar = (0, _styledComponents.default)(_AppBar.default).withConfig({
|
|
39
41
|
displayName: "header__StyledAppBar",
|
|
40
42
|
componentId: "sc-yt81c4-0"
|
|
41
|
-
})(["&&{z-index:", ";background:", ";box-shadow:none;top:0;height:auto;}.header-toolbar{background:", ";color:", ";margin:", "px 0;}.header-link{display:flex;text-decoration:none;flex-shrink:1;overflow:hidden;}.header-logo{margin-right:20px;}.header-title{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;}.header-title__primary{font-size:24px;font-weight:800;color:", ";text-transform:uppercase;display:flex;align-items:center;}.header-title__secondary{font-size:14px;line-height:1.71;color:", ";}.header-addons{display:flex;justify-content:center;align-items:center;flex-shrink:9999999;.user-addon{.header-avatar{width:32px;border-radius:16px;height:auto;}}}.header-menu{display:none;}
|
|
43
|
+
})(["&&{z-index:", ";background:", ";box-shadow:none;top:0;height:auto;}.header-toolbar{background:", ";color:", ";margin:", "px 0;}.header-link{display:flex;text-decoration:none;flex-shrink:1;overflow:hidden;}.header-logo{margin-right:20px;}.header-title{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;}.header-title__primary{font-size:24px;font-weight:800;color:", ";text-transform:uppercase;display:flex;align-items:center;}.header-title__secondary{font-size:14px;line-height:1.71;color:", ";}.header-addons{display:flex;justify-content:center;align-items:center;flex-shrink:9999999;.user-addon{.header-avatar{width:32px;border-radius:16px;height:auto;}}}.header-menu{display:none;}", "{.header-title{display:none;}.header-title__primary{font-size:20px;}.header-menu{display:block;}}"], props => props.theme.zIndex.drawer + 1, props => props.theme.palette.background.default, props => props.theme.palette.background.default, props => props.theme.palette.text.primary, props => props.theme.spacing(1), props => props.theme.typography.color.main, props => props.theme.typography.color.gray, props => props.theme.breakpoints.down('sm'));
|
|
44
|
+
/*
|
|
45
|
+
自定义 logo 相关:
|
|
46
|
+
如果为 logo prop 传入一个自定义的 svg, 并且 svg 中的元素通过 id 引用了 defs 中的元素 (比如 linearGradient),
|
|
47
|
+
这种情况下因为 header 和 sidebar 中会各有一个相同的 svg, defs 中元素的 id 会出现冲突,
|
|
48
|
+
当屏幕较窄时, header 会通过设置 display:none 将 svg logo 隐藏,
|
|
49
|
+
这会导致 svg defs 中的元素不能被正常引用 (比如 fill 引用的 color 失效), 这会进一步导致 sidebar 中的 logo 不能正常显示.
|
|
50
|
+
考虑到上述问题, 目前使用 Hidden 组件控制 logo 的显示/隐藏
|
|
51
|
+
参考: https://blog.patw.me/archives/1820/inline-svg-same-id-and-display-none-issue/
|
|
52
|
+
*/
|
|
42
53
|
|
|
43
54
|
function Header(_ref) {
|
|
44
55
|
let {
|
|
@@ -68,11 +79,13 @@ function Header(_ref) {
|
|
|
68
79
|
}, /*#__PURE__*/_react.default.createElement(_Menu.default, null)), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
|
|
69
80
|
to: homeUrl,
|
|
70
81
|
className: "header-link"
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement(_Hidden.default, {
|
|
83
|
+
smDown: true
|
|
71
84
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
72
85
|
className: "header-logo"
|
|
73
86
|
}, logo || /*#__PURE__*/_react.default.createElement(_Logo.default, {
|
|
74
87
|
showText: false
|
|
75
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
88
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
76
89
|
className: "header-title"
|
|
77
90
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
78
91
|
component: "h2",
|
|
@@ -67,10 +67,10 @@ function Dashboard(_ref) {
|
|
|
67
67
|
const {
|
|
68
68
|
width
|
|
69
69
|
} = (0, _useWindowSize.default)();
|
|
70
|
-
const [drawerMode, setDrawerMode] = (0, _react.useState)(width
|
|
70
|
+
const [drawerMode, setDrawerMode] = (0, _react.useState)(width >= breakpoint ? 'permanent' : 'temporary');
|
|
71
71
|
const [drawerOpen, setDrawerOpen] = (0, _react.useState)(drawerMode === 'permanent');
|
|
72
72
|
(0, _react.useEffect)(() => {
|
|
73
|
-
const newMode = width
|
|
73
|
+
const newMode = width >= breakpoint ? 'permanent' : 'temporary';
|
|
74
74
|
setDrawerMode(newMode);
|
|
75
75
|
setDrawerOpen(newMode !== 'temporary');
|
|
76
76
|
}, [width]);
|
|
@@ -104,7 +104,7 @@ Sidebar.defaultProps = {
|
|
|
104
104
|
const MenuItems = /*#__PURE__*/_react.default.memo(_styledComponents.default.div.withConfig({
|
|
105
105
|
displayName: "sidebar__MenuItems",
|
|
106
106
|
componentId: "sc-gaosgy-0"
|
|
107
|
-
})(["flex:1;display:flex;flex-direction:column;&& .sidebar-logo{display:none;border-bottom:1px solid #eee;background:", ";position:sticky;top:0;z-index:1;padding:10px 0;text-align:center;font-size:0;}
|
|
107
|
+
})(["flex:1;display:flex;flex-direction:column;&& .sidebar-logo{display:none;border-bottom:1px solid #eee;background:", ";position:sticky;top:0;z-index:1;padding:10px 0;text-align:center;font-size:0;}", "{&& .sidebar-logo{display:block;}}"], props => props.theme.palette.background.default, props => props.theme.breakpoints.down('sm')));
|
|
108
108
|
|
|
109
109
|
const gradient = 'linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))';
|
|
110
110
|
const MenuItem = (0, _styledComponents.default)(_Button.default).withConfig({
|
package/lib/Layout/index.js
CHANGED
|
@@ -232,7 +232,7 @@ Layout.defaultProps = {
|
|
|
232
232
|
const Div = _styledComponents.default.div.withConfig({
|
|
233
233
|
displayName: "Layout__Div",
|
|
234
234
|
componentId: "sc-12bllvc-0"
|
|
235
|
-
})(["width:100%;min-height:100vh;display:flex;flex-direction:column;.appbar{&.appbar--border{box-shadow:none;&::before{content:'';position:absolute;left:0;right:0;height:1px;bottom:-1px;display:block;background-color:rgba(0,0,0,0.12);}}}.toolbar{min-height:56px;background:inherit;white-space:nowrap;.menu-logo{font-size:0;margin-right:8px;}.nav-links{display:flex;align-items:center;.nav-link{margin:8px 12px;font-size:16px;display:flex;align-items:center;}.highlight-nav{font-weight:bolder;}}.brand{cursor:pointer;text-decoration:none;overflow:hidden;text-overflow:ellipsis;flex-shrink:1;}.description{color:#999;font-size:15px;margin-left:10px;font-weight:normal;flex-shrink:999999;}}
|
|
235
|
+
})(["width:100%;min-height:100vh;display:flex;flex-direction:column;.appbar{&.appbar--border{box-shadow:none;&::before{content:'';position:absolute;left:0;right:0;height:1px;bottom:-1px;display:block;background-color:rgba(0,0,0,0.12);}}}.toolbar{min-height:56px;background:inherit;white-space:nowrap;.menu-logo{font-size:0;margin-right:8px;}.nav-links{display:flex;align-items:center;.nav-link{margin:8px 12px;font-size:16px;display:flex;align-items:center;}.highlight-nav{font-weight:bolder;}}.brand{cursor:pointer;text-decoration:none;overflow:hidden;text-overflow:ellipsis;flex-shrink:1;}.description{color:#999;font-size:15px;margin-left:10px;font-weight:normal;flex-shrink:999999;}}", "{.toolbar{.menu-button{display:none;}.menu-logo{& + .brand{padding-left:45px;margin-left:-45px;}}}}", "{.toolbar{.nav-links,.menu-logo,.description{display:none;}}}"], props => props.theme.breakpoints.up('md'), props => props.theme.breakpoints.down('sm'));
|
|
236
236
|
|
|
237
237
|
const DrawerDiv = _styledComponents.default.nav.withConfig({
|
|
238
238
|
displayName: "Layout__DrawerDiv",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.62",
|
|
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": "2c6b82d4b6ccdd21ea910734c00fce236f9e260a",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@arcblock/icons": "^1.16.
|
|
59
|
-
"@arcblock/react-hooks": "^1.16.
|
|
58
|
+
"@arcblock/icons": "^1.16.62",
|
|
59
|
+
"@arcblock/react-hooks": "^1.16.62",
|
|
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",
|
|
@@ -6,6 +6,7 @@ import AppBar from '@material-ui/core/AppBar';
|
|
|
6
6
|
import Toolbar from '@material-ui/core/Toolbar';
|
|
7
7
|
import Box from '@material-ui/core/Box';
|
|
8
8
|
import Typography from '@material-ui/core/Typography';
|
|
9
|
+
import Hidden from '@material-ui/core/Hidden';
|
|
9
10
|
import MenuIcon from '@material-ui/icons/Menu';
|
|
10
11
|
import { Link } from 'react-router-dom';
|
|
11
12
|
|
|
@@ -70,19 +71,7 @@ const StyledAppBar = styled(AppBar)`
|
|
|
70
71
|
.header-menu {
|
|
71
72
|
display: none;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
/*
|
|
75
|
-
以下样式用来替代 display:none, 如果为 logo prop 传入一个自定义的 svg, 并且 svg 中的元素通过 id 引用了 defs 中的元素 (比如 linearGradient),
|
|
76
|
-
这种情况下因为 header 和 sidebar 中会各有一个相同的 svg, defs 中元素的 id 会出现冲突,
|
|
77
|
-
当屏幕很窄的情况, header 会通过设置 display:none 将 svg logo 隐藏,
|
|
78
|
-
这会导致 svg defs 中的元素不能被正常引用 (比如 fill 引用的 color 失效), 这会进一步导致 sidebar 中的 logo 不能正常显示
|
|
79
|
-
*/
|
|
80
|
-
.header-logo {
|
|
81
|
-
position: absolute;
|
|
82
|
-
width: 0;
|
|
83
|
-
height: 0;
|
|
84
|
-
overflow: hidden;
|
|
85
|
-
}
|
|
74
|
+
${props => props.theme.breakpoints.down('sm')} {
|
|
86
75
|
.header-title {
|
|
87
76
|
display: none;
|
|
88
77
|
}
|
|
@@ -95,6 +84,15 @@ const StyledAppBar = styled(AppBar)`
|
|
|
95
84
|
}
|
|
96
85
|
`;
|
|
97
86
|
|
|
87
|
+
/*
|
|
88
|
+
自定义 logo 相关:
|
|
89
|
+
如果为 logo prop 传入一个自定义的 svg, 并且 svg 中的元素通过 id 引用了 defs 中的元素 (比如 linearGradient),
|
|
90
|
+
这种情况下因为 header 和 sidebar 中会各有一个相同的 svg, defs 中元素的 id 会出现冲突,
|
|
91
|
+
当屏幕较窄时, header 会通过设置 display:none 将 svg logo 隐藏,
|
|
92
|
+
这会导致 svg defs 中的元素不能被正常引用 (比如 fill 引用的 color 失效), 这会进一步导致 sidebar 中的 logo 不能正常显示.
|
|
93
|
+
考虑到上述问题, 目前使用 Hidden 组件控制 logo 的显示/隐藏
|
|
94
|
+
参考: https://blog.patw.me/archives/1820/inline-svg-same-id-and-display-none-issue/
|
|
95
|
+
*/
|
|
98
96
|
export default function Header({
|
|
99
97
|
children,
|
|
100
98
|
brand,
|
|
@@ -118,7 +116,9 @@ export default function Header({
|
|
|
118
116
|
<MenuIcon />
|
|
119
117
|
</Button>
|
|
120
118
|
<Link to={homeUrl} className="header-link">
|
|
121
|
-
<
|
|
119
|
+
<Hidden smDown>
|
|
120
|
+
<div className="header-logo">{logo || <Logo showText={false} />}</div>
|
|
121
|
+
</Hidden>
|
|
122
122
|
<div className="header-title">
|
|
123
123
|
<Typography component="h2" noWrap className="header-title__primary">
|
|
124
124
|
{brand}
|
|
@@ -64,11 +64,11 @@ export default function Dashboard({
|
|
|
64
64
|
}) {
|
|
65
65
|
const breakpoint = 960;
|
|
66
66
|
const { width } = useWindowSize();
|
|
67
|
-
const [drawerMode, setDrawerMode] = useState(width
|
|
67
|
+
const [drawerMode, setDrawerMode] = useState(width >= breakpoint ? 'permanent' : 'temporary');
|
|
68
68
|
const [drawerOpen, setDrawerOpen] = useState(drawerMode === 'permanent');
|
|
69
69
|
|
|
70
70
|
useEffect(() => {
|
|
71
|
-
const newMode = width
|
|
71
|
+
const newMode = width >= breakpoint ? 'permanent' : 'temporary';
|
|
72
72
|
setDrawerMode(newMode);
|
|
73
73
|
setDrawerOpen(newMode !== 'temporary');
|
|
74
74
|
}, [width]);
|
package/src/Layout/index.js
CHANGED
|
@@ -264,7 +264,7 @@ const Div = styled.div`
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
268
268
|
.toolbar {
|
|
269
269
|
.menu-button {
|
|
270
270
|
display: none;
|
|
@@ -278,7 +278,7 @@ const Div = styled.div`
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
${props => props.theme.breakpoints.down('sm')} {
|
|
282
282
|
.toolbar {
|
|
283
283
|
.nav-links,
|
|
284
284
|
.menu-logo,
|