Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
f344342b
Commit
f344342b
authored
Sep 12, 2018
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show Drawer Setting in preview.pro.ant.design, close #2277
parent
8331a923
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
.eslintrc.js
.eslintrc.js
+3
-0
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+13
-4
src/models/setting.js
src/models/setting.js
+2
-4
No files found.
.eslintrc.js
View file @
f344342b
...
@@ -9,6 +9,9 @@ module.exports = {
...
@@ -9,6 +9,9 @@ module.exports = {
jest
:
true
,
jest
:
true
,
jasmine
:
true
,
jasmine
:
true
,
},
},
globals
:
{
APP_TYPE
:
true
,
},
rules
:
{
rules
:
{
'
react/jsx-filename-extension
'
:
[
1
,
{
extensions
:
[
'
.js
'
]
}],
'
react/jsx-filename-extension
'
:
[
1
,
{
extensions
:
[
'
.js
'
]
}],
'
react/jsx-wrap-multilines
'
:
0
,
'
react/jsx-wrap-multilines
'
:
0
,
...
...
src/layouts/BasicLayout.js
View file @
f344342b
...
@@ -201,6 +201,16 @@ class BasicLayout extends React.PureComponent {
...
@@ -201,6 +201,16 @@ class BasicLayout extends React.PureComponent {
});
});
};
};
renderSettingDrawer
()
{
// Do show SettingDrawer in production
// unless deployed in preview.pro.ant.design as demo
const
{
rendering
}
=
this
.
state
;
if
((
rendering
||
process
.
env
.
NODE_ENV
===
'
production
'
)
&&
APP_TYPE
!==
'
site
'
)
{
return
null
;
}
return
<
SettingDrawer
/>
;
}
render
()
{
render
()
{
const
{
const
{
navTheme
,
navTheme
,
...
@@ -208,7 +218,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -208,7 +218,7 @@ class BasicLayout extends React.PureComponent {
children
,
children
,
location
:
{
pathname
},
location
:
{
pathname
},
}
=
this
.
props
;
}
=
this
.
props
;
const
{
rendering
,
isMobile
}
=
this
.
state
;
const
{
isMobile
}
=
this
.
state
;
const
isTop
=
PropsLayout
===
'
topmenu
'
;
const
isTop
=
PropsLayout
===
'
topmenu
'
;
const
menuData
=
this
.
getMenuData
();
const
menuData
=
this
.
getMenuData
();
const
layout
=
(
const
layout
=
(
...
@@ -242,6 +252,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -242,6 +252,7 @@ class BasicLayout extends React.PureComponent {
<
/Layout
>
<
/Layout
>
<
/Layout
>
<
/Layout
>
);
);
return
(
return
(
<
React
.
Fragment
>
<
React
.
Fragment
>
<
DocumentTitle
title
=
{
this
.
getPageTitle
(
pathname
)}
>
<
DocumentTitle
title
=
{
this
.
getPageTitle
(
pathname
)}
>
...
@@ -253,9 +264,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -253,9 +264,7 @@ class BasicLayout extends React.PureComponent {
)}
)}
<
/ContainerQuery
>
<
/ContainerQuery
>
<
/DocumentTitle
>
<
/DocumentTitle
>
{(
rendering
||
process
.
env
.
NODE_ENV
===
'
production
'
)
?
null
:
(
// Do show SettingDrawer in production
{
this
.
renderSettingDrawer
()}
<
SettingDrawer
/>
)}
<
/React.Fragment
>
<
/React.Fragment
>
);
);
}
}
...
...
src/models/setting.js
View file @
f344342b
...
@@ -4,11 +4,9 @@ import defaultSettings from '../defaultSettings';
...
@@ -4,11 +4,9 @@ import defaultSettings from '../defaultSettings';
let
lessNodesAppended
;
let
lessNodesAppended
;
const
updateTheme
=
primaryColor
=>
{
const
updateTheme
=
primaryColor
=>
{
// // Don't compile less in production!
// // Don't compile less in production!
/* eslint-disable */
if
(
APP_TYPE
!==
'
site
'
)
{
if
(
APP_TYPE
!==
'
site
'
)
{
return
;
return
;
}
}
/* eslint-disable */
// Determine if the component is remounted
// Determine if the component is remounted
if
(
!
primaryColor
)
{
if
(
!
primaryColor
)
{
return
;
return
;
...
@@ -111,8 +109,8 @@ export default {
...
@@ -111,8 +109,8 @@ export default {
if
(
state
.
primaryColor
!==
primaryColor
)
{
if
(
state
.
primaryColor
!==
primaryColor
)
{
updateTheme
(
primaryColor
);
updateTheme
(
primaryColor
);
}
}
if
(
state
.
contentWidth
!==
contentWidth
)
{
if
(
state
.
contentWidth
!==
contentWidth
&&
window
.
dispatchEvent
)
{
window
.
dispatchEvent
?
window
.
dispatchEvent
(
new
Event
(
'
resize
'
))
:
null
;
window
.
dispatchEvent
(
new
Event
(
'
resize
'
))
;
}
}
updateColorWeak
(
colorWeak
);
updateColorWeak
(
colorWeak
);
window
.
history
.
replaceState
(
null
,
'
setting
'
,
urlParams
.
href
);
window
.
history
.
replaceState
(
null
,
'
setting
'
,
urlParams
.
href
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment