@@ -26,6 +26,7 @@ import {
26
26
NavLayoutItemActiveStyleType ,
27
27
} from "comps/controls/styleControlConstants" ;
28
28
import { dropdownControl } from "comps/controls/dropdownControl" ;
29
+ import _ from "lodash" ;
29
30
30
31
const DEFAULT_WIDTH = 240 ;
31
32
const ModeOptions = [
@@ -156,6 +157,7 @@ let NavTmpLayout = (function () {
156
157
} ,
157
158
] ) ,
158
159
width : withDefault ( StringControl , DEFAULT_WIDTH ) ,
160
+ backgroundImage : withDefault ( StringControl , "" ) ,
159
161
mode : dropdownControl ( ModeOptions , "inline" ) ,
160
162
navStyle : withDefault ( styleControl ( NavLayoutStyle ) , defaultStyle ) ,
161
163
navItemStyle : withDefault ( styleControl ( NavLayoutItemStyle ) , defaultStyle ) ,
@@ -170,7 +172,9 @@ let NavTmpLayout = (function () {
170
172
171
173
return (
172
174
< div style = { { overflowY : 'auto' } } >
173
- < Section name = { trans ( "menu" ) } > { menuPropertyView ( children . items ) } </ Section >
175
+ < Section name = { trans ( "menu" ) } >
176
+ { menuPropertyView ( children . items ) }
177
+ </ Section >
174
178
< Section name = { sectionNames . layout } >
175
179
{ children . width . propertyView ( {
176
180
label : trans ( "navLayout.width" ) ,
@@ -181,6 +185,10 @@ let NavTmpLayout = (function () {
181
185
label : trans ( "labelProp.position" ) ,
182
186
radioButton : true
183
187
} ) }
188
+ { children . backgroundImage . propertyView ( {
189
+ label : `Background Image` ,
190
+ placeholder : 'https://temp.im/350x400' ,
191
+ } ) }
184
192
</ Section >
185
193
< Section name = { trans ( "navLayout.navStyle" ) } >
186
194
{ children . navStyle . getPropertyView ( ) }
@@ -222,7 +230,8 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
222
230
const navItemStyle = useMemo ( ( ) => comp . children . navItemStyle . getView ( ) , [ comp . children . navItemStyle ] ) ;
223
231
const navItemHoverStyle = useMemo ( ( ) => comp . children . navItemHoverStyle . getView ( ) , [ comp . children . navItemHoverStyle ] ) ;
224
232
const navItemActiveStyle = useMemo ( ( ) => comp . children . navItemActiveStyle . getView ( ) , [ comp . children . navItemActiveStyle ] ) ;
225
- console . log ( navItemActiveStyle ) ;
233
+ const backgroundImage = comp . children . backgroundImage . getView ( ) ;
234
+
226
235
// filter out hidden. unauthorised items filtered by server
227
236
const filterItem = useCallback ( ( item : LayoutMenuItemComp ) : boolean => {
228
237
return ! item . children . hidden . getView ( ) ;
@@ -367,6 +376,10 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
367
376
return '0px' ;
368
377
}
369
378
379
+ let backgroundStyle = navStyle . background ;
380
+ if ( ! _ . isEmpty ( backgroundImage ) ) {
381
+ backgroundStyle = `center / cover url('${ backgroundImage } ') no-repeat, ${ backgroundStyle } ` ;
382
+ }
370
383
let content = (
371
384
< Layout >
372
385
< StyledSide theme = "light" width = { navWidth } >
@@ -376,18 +389,18 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
376
389
style = { {
377
390
height : `calc(100% - ${ getVerticalMargin ( navStyle . margin . split ( ' ' ) ) } )` ,
378
391
width : `calc(100% - ${ getHorizontalMargin ( navStyle . margin . split ( ' ' ) ) } )` ,
392
+ borderRight : `1px solid ${ navStyle . border } ` ,
379
393
borderRadius : navStyle . radius ,
380
394
color : navStyle . text ,
381
395
margin : navStyle . margin ,
382
396
padding : navStyle . padding ,
383
- background : navStyle . background ,
384
- borderRight : `1px solid ${ navStyle . border } ` ,
397
+ background : backgroundStyle ,
385
398
} }
386
399
defaultOpenKeys = { defaultOpenKeys }
387
400
selectedKeys = { [ selectedKey ] }
388
401
$navItemStyle = { {
389
402
width : `calc(100% - ${ getHorizontalMargin ( navItemStyle . margin . split ( ' ' ) ) } )` ,
390
- ...navItemStyle
403
+ ...navItemStyle ,
391
404
} }
392
405
$navItemHoverStyle = { navItemHoverStyle }
393
406
$navItemActiveStyle = { navItemActiveStyle }
0 commit comments