@@ -8,7 +8,8 @@ import { translate } from '../../services/translation.service';
88} )
99export class AppTeamLanding {
1010 // private allowWebp = localStorage.getItem('allowWebp') === 'true' ? true : false;
11-
11+ backgroundPhoto : string ;
12+ headshotPhoto : string ;
1213 @Prop ( ) match : MatchResults ;
1314 @Prop ( ) history : RouterHistory ;
1415
@@ -402,6 +403,10 @@ export class AppTeamLanding {
402403 this . changeMetadata ( ) ;
403404 }
404405
406+ componentDidUnload ( ) {
407+ window . removeEventListener ( 'resize' , this . updateBackground , false ) ;
408+ }
409+
405410 changeMetadata ( ) {
406411 if ( this . data [ this . match . params . member ] ) {
407412 // Change meta tags dynamically
@@ -421,32 +426,39 @@ export class AppTeamLanding {
421426 return img ;
422427 }
423428
429+ updateBackground ( ) {
430+ console . error ( 'this is the background photo - ' , this . backgroundPhoto ) ;
431+ const hero = document . querySelector ( '.team-landing > .container-fluid > .hero' ) as HTMLElement ;
432+ if ( window . innerWidth > 767.98 ) {
433+ hero . style . backgroundColor = '#292A2D' ;
434+ if ( this . backgroundPhoto != null ) {
435+ console . error ( 'THIS IS THE RESIZE' ) ;
436+ hero . style . backgroundImage = `linear-gradient(90deg, #000000 20%, rgba(255, 255, 255, 0) 70%), url(${ this . backgroundPhoto } )` ;
437+ }
438+ } else {
439+ hero . style . backgroundImage = 'none' ;
440+ hero . style . backgroundColor = 'transparent' ;
441+ }
442+ }
443+
424444 render ( ) {
425- const backgroundPhoto = this . changeImageFormat ( this . data [ this . match . params . member ] . backgroundPhoto ? this . data [ this . match . params . member ] . backgroundPhoto : null ) ;
426- const headshotPhoto = this . changeImageFormat ( this . data [ this . match . params . member ] . headshotPhoto ) ;
445+ console . error ( 'render - ' , this . data [ this . match . params . member ] . backgroundPhoto ) ;
446+ console . error ( 'again - ' , this . data [ this . match . params . member ] . headshotPhoto ) ;
447+
448+ this . backgroundPhoto = this . changeImageFormat ( this . data [ this . match . params . member ] . backgroundPhoto ? this . data [ this . match . params . member ] . backgroundPhoto : null ) ;
449+ this . headshotPhoto = this . changeImageFormat ( this . data [ this . match . params . member ] . headshotPhoto ) ;
427450 let style = { } ;
428451 if ( window . innerWidth > 767.98 ) {
429- style = backgroundPhoto
452+ style = this . backgroundPhoto
430453 ? {
431- 'background-image' : `linear-gradient(90deg, #000000 20%, rgba(255, 255, 255, 0) 70%), url(${ backgroundPhoto } )` ,
454+ 'background-image' : `linear-gradient(90deg, #000000 20%, rgba(255, 255, 255, 0) 70%), url(${ this . backgroundPhoto } )` ,
432455 }
433456 : {
434457 'background-color' : '#292A2D' ,
435458 } ;
436459 }
437- window . addEventListener ( 'resize' , ( ) => {
438- const backgroundPhoto = this . changeImageFormat ( this . data [ this . match . params . member ] . backgroundPhoto ? this . data [ this . match . params . member ] . backgroundPhoto : null ) ;
439- const hero = document . querySelector ( '.team-landing > .container-fluid > .hero' ) as HTMLElement ;
440- if ( window . innerWidth > 767.98 ) {
441- hero . style . backgroundColor = '#292A2D' ;
442- if ( backgroundPhoto ) {
443- hero . style . backgroundImage = `linear-gradient(90deg, #000000 20%, rgba(255, 255, 255, 0) 70%), url(${ backgroundPhoto } )` ;
444- }
445- } else {
446- hero . style . backgroundImage = 'none' ;
447- hero . style . backgroundColor = 'transparent' ;
448- }
449- } ) ;
460+
461+ window . addEventListener ( 'resize' , this . updateBackground ) ;
450462
451463 return (
452464 < section class = "team-landing" >
@@ -456,7 +468,7 @@ export class AppTeamLanding {
456468 < div class = "container-fluid" >
457469 < div class = "row justify-content-center align-items-center hero" style = { style } >
458470 < div class = "col-10 col-sm-12 d-block d-md-none" >
459- < app-img class = "headshot-mobile" src = { headshotPhoto } />
471+ < app-img class = "headshot-mobile" src = { this . headshotPhoto } />
460472 </ div >
461473 < div class = "col-11 col-sm-9 col-md-7 col-lg-6 align-self-start" >
462474 < div class = "header-text" >
@@ -470,7 +482,7 @@ export class AppTeamLanding {
470482 < p > { this . data [ this . match . params . member ] . headerText } </ p >
471483 </ div >
472484 </ div >
473- < div class = "col-md-4 d-none d-md-block" > { ! backgroundPhoto && < app-img class = "headshot" src = { headshotPhoto } /> } </ div >
485+ < div class = "col-md-4 d-none d-md-block" > { ! this . backgroundPhoto && < app-img class = "headshot" src = { this . headshotPhoto } /> } </ div >
474486 </ div >
475487
476488 < div class = "row align-items-center justify-content-center bio" >
0 commit comments