@arcblock/ux 1.16.49 → 1.16.52
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 +3 -4
- package/lib/Dialog/dialog.js +1 -1
- package/lib/Layout/dashboard/header.js +9 -6
- package/lib/Layout/dashboard/index.js +11 -6
- package/lib/Layout/dashboard/sidebar.js +8 -5
- package/package.json +4 -4
- package/src/Blocklet/index.js +3 -8
- package/src/Dialog/dialog.js +1 -1
- package/src/Layout/dashboard/header.js +16 -4
- package/src/Layout/dashboard/index.js +11 -1
- package/src/Layout/dashboard/sidebar.js +4 -2
package/lib/Blocklet/index.js
CHANGED
|
@@ -45,12 +45,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
45
45
|
const Div = _styledComponents.default.div.withConfig({
|
|
46
46
|
displayName: "Blocklet__Div",
|
|
47
47
|
componentId: "sc-3dga5l-0"
|
|
48
|
-
})(["&.arcblock-blocklet{padding:0 16px;background:", ";overflow:hidden;box-shadow:0px 0px 8px #f0f0f0;&:hover{box-shadow:0px 2px 12px #f0f0f0;}}.arcblock-blocklet__content{padding:16px 0 0 0;}.arcblock-blocklet__content--main{display:flex;align-items:center;cursor:pointer;}.arcblock-blocklet__content--body{overflow:hidden;flex:1;display:flex;align-items:flex-start;}.arcblock-blocklet__addons{padding:16px 0;}.arcblock-blocklet__cover{width:80px;height:80px;margin-right:12px;overflow:hidden;border-radius:12px;transform:translateZ(0);}.arcblock-blocklet__info{flex:1;overflow:hidden;.arcblock-blocklet__button{margin-top:16px;display:inline-block;}}.arcblock-blocklet__button--hover{&:not(.Mui-disabled){position:relative;z-index:1;&::before{content:'';
|
|
48
|
+
})(["&.arcblock-blocklet{padding:0 16px;background:", ";overflow:hidden;box-shadow:0px 0px 8px #f0f0f0;&:hover{box-shadow:0px 2px 12px #f0f0f0;}}.arcblock-blocklet__content{padding:16px 0 0 0;}.arcblock-blocklet__content--main{display:flex;align-items:center;cursor:pointer;}.arcblock-blocklet__content--body{overflow:hidden;flex:1;display:flex;align-items:flex-start;}.arcblock-blocklet__addons{padding:16px 0;}.arcblock-blocklet__cover{width:80px;height:80px;margin-right:12px;overflow:hidden;border-radius:12px;transform:translateZ(0);}.arcblock-blocklet__info{flex:1;overflow:hidden;.arcblock-blocklet__button{margin-top:16px;display:inline-block;}}.arcblock-blocklet__button--hover{&:not(.Mui-disabled){position:relative;z-index:1;&::before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;transition:opacity 0.3s;}&:hover::before{opacity:0;}&::after{content:'';position:absolute;height:100%;width:100%;background-color:", ";transform:scale(0.1);opacity:0;z-index:-1;transition:transform 0.3s,opacity 0.3s,background-color 0.3s;}&:hover::after{opacity:1;transform-origin:center;transform:scale(1);}}&:not(.Mui-disabled){background-color:transparent !important;color:", ";}&:not(.Mui-disabled){&:hover{color:", ";}}}.arcblock-blocklet__title{margin:0;font-size:18px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.arcblock-blocklet__describe{margin:0 0 2px 0;color:#999;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.arcblock-blocklet__addons{display:flex;justify-content:space-between;color:#999;font-size:14px;position:relative;}.arcblock-blocklet__addons--item{white-space:nowrap;}&.arcblock-blocklet--size-md{&:hover{position:relative;}.arcblock-blocklet__title{height:2.3em;margin-bottom:3px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:initial;white-space:initial;word-break:break-all;}.arcblock-blocklet__describe{white-space:normal;height:2.86em;}.arcblock-blocklet__button{margin-top:5px;}}&.arcblock-blocklet--size-sm,&.arcblock-blocklet--size-xs{.arcblock-blocklet__cover{width:40px;height:40px;border-radius:6px;}.arcblock-blocklet__content{padding:16px 0;}.arcblock-blocklet__addons{padding:8px 0;.arcblock-blocklet__addons--item{font-size:12px;}}}&.arcblock-blocklet--size-xs{.arcblock-blocklet__addons{display:none !important;}}"], props => props.theme.palette.common.white, props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.theme.palette.common.white);
|
|
49
49
|
|
|
50
50
|
const ActionButton = _styledComponents.default.div.withConfig({
|
|
51
51
|
displayName: "Blocklet__ActionButton",
|
|
52
52
|
componentId: "sc-3dga5l-1"
|
|
53
|
-
})(["background-color:transparent !important;& >:not(.Mui-disabled){position:relative;z-index:1;&::before{content:'';
|
|
53
|
+
})(["background-color:transparent !important;& >:not(.Mui-disabled){position:relative;z-index:1;&::before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;transition:opacity 0.3s;}&:hover::before{opacity:0;}&::after{content:'';position:absolute;height:100%;width:100%;background-color:", ";transform:scale(0.1);opacity:0;z-index:-1;transition:transform 0.3s,opacity 0.3s,background-color 0.3s;}&:hover::after{opacity:1;transform-origin:center;transform:scale(1);}}& >:not(.Mui-disabled){background-color:transparent !important;color:", "!important;}& >:not(.Mui-disabled){&:hover{color:", "!important;}}"], props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.theme.palette.common.white);
|
|
54
54
|
|
|
55
55
|
exports.ActionButton = ActionButton;
|
|
56
56
|
|
|
@@ -189,9 +189,8 @@ function Blocklet(_ref2) {
|
|
|
189
189
|
display: isStickyButton ? 'block' : ''
|
|
190
190
|
}
|
|
191
191
|
}, button || onButtonClick && /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
192
|
-
rounded: true,
|
|
193
192
|
className: "arcblock-blocklet__button--hover",
|
|
194
|
-
variant: "
|
|
193
|
+
variant: "outlined",
|
|
195
194
|
color: "primary",
|
|
196
195
|
size: "small",
|
|
197
196
|
disabled: buttonDisabled || buttonLoading,
|
package/lib/Dialog/dialog.js
CHANGED
|
@@ -126,7 +126,7 @@ Dialog.defaultProps = {
|
|
|
126
126
|
const StyledMuiDialog = (0, _styledComponents.default)(_Dialog.default).withConfig({
|
|
127
127
|
displayName: "dialog__StyledMuiDialog",
|
|
128
128
|
componentId: "sc-kt5gv0-0"
|
|
129
|
-
})([".MuiDialog-paper{
|
|
129
|
+
})([".MuiDialog-paper{", ";}.MuiDialogContent-root{padding:16px 24px;}.MuiDialogActions-root{padding:8px 24px 16px 24px;}.MuiDialogActions-root.ux-dialog_actions--left{justify-content:flex-start;}.MuiDialogActions-root.ux-dialog_actions--right{justify-content:flex-end;}.MuiDialogActions-root.ux-dialog_actions--center{justify-content:center;}"], props => props.fullScreen ? 'border-radius: 0;' : '');
|
|
130
130
|
|
|
131
131
|
const Header = _styledComponents.default.div.withConfig({
|
|
132
132
|
displayName: "dialog__Header",
|
|
@@ -27,7 +27,7 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
27
27
|
|
|
28
28
|
var _Logo = _interopRequireDefault(require("../../Logo"));
|
|
29
29
|
|
|
30
|
-
const _excluded = ["children", "brand", "brandAddon", "description", "addons", "onToggleMenu", "homeUrl"];
|
|
30
|
+
const _excluded = ["children", "brand", "brandAddon", "description", "addons", "onToggleMenu", "homeUrl", "logo"];
|
|
31
31
|
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
33
|
|
|
@@ -38,7 +38,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
38
38
|
const StyledAppBar = (0, _styledComponents.default)(_AppBar.default).withConfig({
|
|
39
39
|
displayName: "header__StyledAppBar",
|
|
40
40
|
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;}@media (max-width:", "px){.header-logo
|
|
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;}@media (max-width:", "px){.header-logo{position:absolute;width:0;height:0;overflow:hidden;}.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.values.md);
|
|
42
42
|
|
|
43
43
|
function Header(_ref) {
|
|
44
44
|
let {
|
|
@@ -48,7 +48,8 @@ function Header(_ref) {
|
|
|
48
48
|
description,
|
|
49
49
|
addons,
|
|
50
50
|
onToggleMenu,
|
|
51
|
-
homeUrl
|
|
51
|
+
homeUrl,
|
|
52
|
+
logo
|
|
52
53
|
} = _ref,
|
|
53
54
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
54
55
|
|
|
@@ -69,7 +70,7 @@ function Header(_ref) {
|
|
|
69
70
|
className: "header-link"
|
|
70
71
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
71
72
|
className: "header-logo"
|
|
72
|
-
}, /*#__PURE__*/_react.default.createElement(_Logo.default, {
|
|
73
|
+
}, logo || /*#__PURE__*/_react.default.createElement(_Logo.default, {
|
|
73
74
|
showText: false
|
|
74
75
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
75
76
|
className: "header-title"
|
|
@@ -97,11 +98,13 @@ Header.propTypes = {
|
|
|
97
98
|
description: _propTypes.default.string.isRequired,
|
|
98
99
|
children: _propTypes.default.any,
|
|
99
100
|
addons: _propTypes.default.any,
|
|
100
|
-
homeUrl: _propTypes.default.string
|
|
101
|
+
homeUrl: _propTypes.default.string,
|
|
102
|
+
logo: _propTypes.default.any
|
|
101
103
|
};
|
|
102
104
|
Header.defaultProps = {
|
|
103
105
|
children: null,
|
|
104
106
|
addons: null,
|
|
105
107
|
brandAddon: null,
|
|
106
|
-
homeUrl: '/'
|
|
108
|
+
homeUrl: '/',
|
|
109
|
+
logo: null
|
|
107
110
|
};
|
|
@@ -27,7 +27,7 @@ var _header = _interopRequireDefault(require("./header"));
|
|
|
27
27
|
|
|
28
28
|
var _Footer = _interopRequireDefault(require("../../Footer"));
|
|
29
29
|
|
|
30
|
-
const _excluded = ["children", "title", "brand", "description", "brandAddon", "headerAddon", "images", "links", "prefix", "fullWidth", "contentLayout", "className", "homeUrl"];
|
|
30
|
+
const _excluded = ["children", "title", "brand", "description", "brandAddon", "headerAddon", "images", "links", "prefix", "fullWidth", "contentLayout", "className", "homeUrl", "logo"];
|
|
31
31
|
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
33
|
|
|
@@ -58,7 +58,8 @@ function Dashboard(_ref) {
|
|
|
58
58
|
fullWidth,
|
|
59
59
|
contentLayout,
|
|
60
60
|
className,
|
|
61
|
-
homeUrl
|
|
61
|
+
homeUrl,
|
|
62
|
+
logo
|
|
62
63
|
} = _ref,
|
|
63
64
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
64
65
|
|
|
@@ -90,7 +91,8 @@ function Dashboard(_ref) {
|
|
|
90
91
|
brandAddon: brandAddon,
|
|
91
92
|
description: description,
|
|
92
93
|
addons: headerAddon,
|
|
93
|
-
homeUrl: homeUrl
|
|
94
|
+
homeUrl: homeUrl,
|
|
95
|
+
logo: logo
|
|
94
96
|
}), /*#__PURE__*/_react.default.createElement(_Box.default, {
|
|
95
97
|
display: "flex",
|
|
96
98
|
className: "dashboard__body"
|
|
@@ -110,7 +112,8 @@ function Dashboard(_ref) {
|
|
|
110
112
|
className: "dashboard__sidebar",
|
|
111
113
|
images: images,
|
|
112
114
|
links: links,
|
|
113
|
-
prefix: prefix
|
|
115
|
+
prefix: prefix,
|
|
116
|
+
logo: logo
|
|
114
117
|
})), /*#__PURE__*/_react.default.createElement(_Box.default, {
|
|
115
118
|
className: "dashboard__main"
|
|
116
119
|
}, /*#__PURE__*/_react.default.createElement(_Container.default, {
|
|
@@ -135,7 +138,8 @@ Dashboard.propTypes = {
|
|
|
135
138
|
contentLayout: _propTypes.default.oneOf(['row', 'column']),
|
|
136
139
|
fullWidth: _propTypes.default.bool,
|
|
137
140
|
className: _propTypes.default.string,
|
|
138
|
-
homeUrl: _propTypes.default.string
|
|
141
|
+
homeUrl: _propTypes.default.string,
|
|
142
|
+
logo: _propTypes.default.any
|
|
139
143
|
};
|
|
140
144
|
Dashboard.defaultProps = {
|
|
141
145
|
title: 'Home',
|
|
@@ -145,5 +149,6 @@ Dashboard.defaultProps = {
|
|
|
145
149
|
prefix: '/images',
|
|
146
150
|
fullWidth: false,
|
|
147
151
|
className: '',
|
|
148
|
-
homeUrl: '/'
|
|
152
|
+
homeUrl: '/',
|
|
153
|
+
logo: null
|
|
149
154
|
};
|
|
@@ -25,7 +25,7 @@ var _image = _interopRequireDefault(require("../../Icon/image"));
|
|
|
25
25
|
|
|
26
26
|
var _Logo = _interopRequireDefault(require("../../Logo"));
|
|
27
27
|
|
|
28
|
-
const _excluded = ["location", "theme", "images", "links", "prefix", "addons"];
|
|
28
|
+
const _excluded = ["location", "theme", "images", "links", "prefix", "addons", "logo"];
|
|
29
29
|
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
31
|
|
|
@@ -40,7 +40,8 @@ function Sidebar(_ref) {
|
|
|
40
40
|
images,
|
|
41
41
|
links,
|
|
42
42
|
prefix,
|
|
43
|
-
addons
|
|
43
|
+
addons,
|
|
44
|
+
logo
|
|
44
45
|
} = _ref,
|
|
45
46
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
47
|
|
|
@@ -52,7 +53,7 @@ function Sidebar(_ref) {
|
|
|
52
53
|
return /*#__PURE__*/_react.default.createElement(MenuItems, rest, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
|
|
53
54
|
to: "/",
|
|
54
55
|
className: "sidebar-logo"
|
|
55
|
-
}, /*#__PURE__*/_react.default.createElement(_Logo.default, {
|
|
56
|
+
}, logo || /*#__PURE__*/_react.default.createElement(_Logo.default, {
|
|
56
57
|
showText: false,
|
|
57
58
|
size: 20
|
|
58
59
|
})), links.map(_ref2 => {
|
|
@@ -91,11 +92,13 @@ Sidebar.propTypes = {
|
|
|
91
92
|
images: _propTypes.default.object.isRequired,
|
|
92
93
|
links: _propTypes.default.array.isRequired,
|
|
93
94
|
prefix: _propTypes.default.string,
|
|
94
|
-
addons: _propTypes.default.any
|
|
95
|
+
addons: _propTypes.default.any,
|
|
96
|
+
logo: _propTypes.default.any
|
|
95
97
|
};
|
|
96
98
|
Sidebar.defaultProps = {
|
|
97
99
|
prefix: '/images',
|
|
98
|
-
addons: null
|
|
100
|
+
addons: null,
|
|
101
|
+
logo: null
|
|
99
102
|
};
|
|
100
103
|
|
|
101
104
|
const MenuItems = /*#__PURE__*/_react.default.memo(_styledComponents.default.div.withConfig({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.52",
|
|
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": "aebb473ae14fe044b4f840158d78a9e52d114951",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@arcblock/icons": "^1.16.
|
|
59
|
-
"@arcblock/react-hooks": "^1.16.
|
|
58
|
+
"@arcblock/icons": "^1.16.52",
|
|
59
|
+
"@arcblock/react-hooks": "^1.16.52",
|
|
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/Blocklet/index.js
CHANGED
|
@@ -64,7 +64,6 @@ const Div = styled.div`
|
|
|
64
64
|
z-index: 1;
|
|
65
65
|
&::before {
|
|
66
66
|
content: '';
|
|
67
|
-
border-radius: 100vw;
|
|
68
67
|
position: absolute;
|
|
69
68
|
height: 100%;
|
|
70
69
|
width: 100%;
|
|
@@ -84,7 +83,6 @@ const Div = styled.div`
|
|
|
84
83
|
transform: scale(0.1);
|
|
85
84
|
opacity: 0;
|
|
86
85
|
z-index: -1;
|
|
87
|
-
border-radius: 100vw;
|
|
88
86
|
transition: transform 0.3s, opacity 0.3s, background-color 0.3s;
|
|
89
87
|
}
|
|
90
88
|
&:hover::after {
|
|
@@ -95,7 +93,7 @@ const Div = styled.div`
|
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
&:not(.Mui-disabled) {
|
|
98
|
-
background-color:
|
|
96
|
+
background-color: transparent !important;
|
|
99
97
|
color: ${props => props.theme.palette.primary.main};
|
|
100
98
|
}
|
|
101
99
|
&:not(.Mui-disabled) {
|
|
@@ -185,7 +183,6 @@ const ActionButton = styled.div`
|
|
|
185
183
|
z-index: 1;
|
|
186
184
|
&::before {
|
|
187
185
|
content: '';
|
|
188
|
-
border-radius: 100vw;
|
|
189
186
|
position: absolute;
|
|
190
187
|
height: 100%;
|
|
191
188
|
width: 100%;
|
|
@@ -205,7 +202,6 @@ const ActionButton = styled.div`
|
|
|
205
202
|
transform: scale(0.1);
|
|
206
203
|
opacity: 0;
|
|
207
204
|
z-index: -1;
|
|
208
|
-
border-radius: 100vw;
|
|
209
205
|
transition: transform 0.3s, opacity 0.3s, background-color 0.3s;
|
|
210
206
|
}
|
|
211
207
|
&:hover::after {
|
|
@@ -215,7 +211,7 @@ const ActionButton = styled.div`
|
|
|
215
211
|
}
|
|
216
212
|
}
|
|
217
213
|
& > :not(.Mui-disabled) {
|
|
218
|
-
background-color:
|
|
214
|
+
background-color: transparent !important;
|
|
219
215
|
color: ${props => props.theme.palette.primary.main}!important;
|
|
220
216
|
}
|
|
221
217
|
& > :not(.Mui-disabled) {
|
|
@@ -340,9 +336,8 @@ export default function Blocklet({
|
|
|
340
336
|
{button ||
|
|
341
337
|
(onButtonClick && (
|
|
342
338
|
<Button
|
|
343
|
-
rounded
|
|
344
339
|
className="arcblock-blocklet__button--hover"
|
|
345
|
-
variant="
|
|
340
|
+
variant="outlined"
|
|
346
341
|
color="primary"
|
|
347
342
|
size="small"
|
|
348
343
|
disabled={buttonDisabled || buttonLoading}
|
package/src/Dialog/dialog.js
CHANGED
|
@@ -106,7 +106,7 @@ Dialog.defaultProps = {
|
|
|
106
106
|
|
|
107
107
|
const StyledMuiDialog = styled(MuiDialog)`
|
|
108
108
|
.MuiDialog-paper {
|
|
109
|
-
|
|
109
|
+
${props => (props.fullScreen ? 'border-radius: 0;' : '')};
|
|
110
110
|
}
|
|
111
111
|
.MuiDialogContent-root {
|
|
112
112
|
padding: 16px 24px;
|
|
@@ -71,7 +71,18 @@ const StyledAppBar = styled(AppBar)`
|
|
|
71
71
|
display: none;
|
|
72
72
|
}
|
|
73
73
|
@media (max-width: ${props => props.theme.breakpoints.values.md}px) {
|
|
74
|
-
|
|
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
|
+
}
|
|
75
86
|
.header-title {
|
|
76
87
|
display: none;
|
|
77
88
|
}
|
|
@@ -92,6 +103,7 @@ export default function Header({
|
|
|
92
103
|
addons,
|
|
93
104
|
onToggleMenu,
|
|
94
105
|
homeUrl,
|
|
106
|
+
logo,
|
|
95
107
|
...rest
|
|
96
108
|
}) {
|
|
97
109
|
return (
|
|
@@ -106,9 +118,7 @@ export default function Header({
|
|
|
106
118
|
<MenuIcon />
|
|
107
119
|
</Button>
|
|
108
120
|
<Link to={homeUrl} className="header-link">
|
|
109
|
-
<div className="header-logo">
|
|
110
|
-
<Logo showText={false} />
|
|
111
|
-
</div>
|
|
121
|
+
<div className="header-logo">{logo || <Logo showText={false} />}</div>
|
|
112
122
|
<div className="header-title">
|
|
113
123
|
<Typography component="h2" noWrap className="header-title__primary">
|
|
114
124
|
{brand}
|
|
@@ -135,6 +145,7 @@ Header.propTypes = {
|
|
|
135
145
|
children: PropTypes.any,
|
|
136
146
|
addons: PropTypes.any,
|
|
137
147
|
homeUrl: PropTypes.string,
|
|
148
|
+
logo: PropTypes.any,
|
|
138
149
|
};
|
|
139
150
|
|
|
140
151
|
Header.defaultProps = {
|
|
@@ -142,4 +153,5 @@ Header.defaultProps = {
|
|
|
142
153
|
addons: null,
|
|
143
154
|
brandAddon: null,
|
|
144
155
|
homeUrl: '/',
|
|
156
|
+
logo: null,
|
|
145
157
|
};
|
|
@@ -59,6 +59,7 @@ export default function Dashboard({
|
|
|
59
59
|
contentLayout,
|
|
60
60
|
className,
|
|
61
61
|
homeUrl,
|
|
62
|
+
logo,
|
|
62
63
|
...rest
|
|
63
64
|
}) {
|
|
64
65
|
const breakpoint = 960;
|
|
@@ -89,6 +90,7 @@ export default function Dashboard({
|
|
|
89
90
|
description={description}
|
|
90
91
|
addons={headerAddon}
|
|
91
92
|
homeUrl={homeUrl}
|
|
93
|
+
logo={logo}
|
|
92
94
|
/>
|
|
93
95
|
<Box display="flex" className="dashboard__body">
|
|
94
96
|
<Drawer
|
|
@@ -98,7 +100,13 @@ export default function Dashboard({
|
|
|
98
100
|
open={drawerOpen}
|
|
99
101
|
onClose={onToggleDrawer}
|
|
100
102
|
ModalProps={{ disablePortal: true, keepMounted: true }}>
|
|
101
|
-
<Sidebar
|
|
103
|
+
<Sidebar
|
|
104
|
+
className="dashboard__sidebar"
|
|
105
|
+
images={images}
|
|
106
|
+
links={links}
|
|
107
|
+
prefix={prefix}
|
|
108
|
+
logo={logo}
|
|
109
|
+
/>
|
|
102
110
|
</Drawer>
|
|
103
111
|
<Box className="dashboard__main">
|
|
104
112
|
<Container maxWidth={isFullWidth ? false : 'lg'} className="dashboard__content">
|
|
@@ -126,6 +134,7 @@ Dashboard.propTypes = {
|
|
|
126
134
|
fullWidth: PropTypes.bool,
|
|
127
135
|
className: PropTypes.string,
|
|
128
136
|
homeUrl: PropTypes.string,
|
|
137
|
+
logo: PropTypes.any,
|
|
129
138
|
};
|
|
130
139
|
|
|
131
140
|
Dashboard.defaultProps = {
|
|
@@ -137,4 +146,5 @@ Dashboard.defaultProps = {
|
|
|
137
146
|
fullWidth: false,
|
|
138
147
|
className: '',
|
|
139
148
|
homeUrl: '/',
|
|
149
|
+
logo: null,
|
|
140
150
|
};
|
|
@@ -11,7 +11,7 @@ import teal from '@material-ui/core/colors/teal';
|
|
|
11
11
|
import ImageIcon from '../../Icon/image';
|
|
12
12
|
import Logo from '../../Logo';
|
|
13
13
|
|
|
14
|
-
function Sidebar({ location, theme, images, links, prefix, addons, ...rest }) {
|
|
14
|
+
function Sidebar({ location, theme, images, links, prefix, addons, logo, ...rest }) {
|
|
15
15
|
const isSelected = (url, name) => {
|
|
16
16
|
const pattern = new RegExp(`/${name}`);
|
|
17
17
|
return pattern.test(location.pathname);
|
|
@@ -20,7 +20,7 @@ function Sidebar({ location, theme, images, links, prefix, addons, ...rest }) {
|
|
|
20
20
|
return (
|
|
21
21
|
<MenuItems {...rest}>
|
|
22
22
|
<Link to="/" className="sidebar-logo">
|
|
23
|
-
<Logo showText={false} size={20} />
|
|
23
|
+
{logo || <Logo showText={false} size={20} />}
|
|
24
24
|
</Link>
|
|
25
25
|
{links.map(({ url, name, title, showBadge }) => {
|
|
26
26
|
const selected = isSelected(url, name);
|
|
@@ -52,11 +52,13 @@ Sidebar.propTypes = {
|
|
|
52
52
|
links: PropTypes.array.isRequired,
|
|
53
53
|
prefix: PropTypes.string,
|
|
54
54
|
addons: PropTypes.any,
|
|
55
|
+
logo: PropTypes.any,
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
Sidebar.defaultProps = {
|
|
58
59
|
prefix: '/images',
|
|
59
60
|
addons: null,
|
|
61
|
+
logo: null,
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
const MenuItems = React.memo(styled.div`
|