11import { ChangeDetectionStrategy , Component , HostListener , Inject , Injector , TemplateRef , Type } from '@angular/core' ;
22import { IconType } from '@hypertrace/assets-library' ;
3- import { ExternalNavigationParams , LayoutChangeService } from '@hypertrace/common' ;
3+ import { ExternalNavigationParams , GLOBAL_HEADER_HEIGHT , LayoutChangeService } from '@hypertrace/common' ;
44import { ButtonStyle } from '../../button/button' ;
55import { IconSize } from '../../icon/icon-size' ;
6- import { POPOVER_DATA } from '../../popover/popover' ;
6+ import { PopoverFixedPositionLocation , POPOVER_DATA } from '../../popover/popover' ;
77import { PopoverRef } from '../../popover/popover-ref' ;
88import { SheetConstructionData } from '../overlay.service' ;
99import { SheetOverlayConfig , SheetSize } from './sheet' ;
@@ -72,6 +72,7 @@ export class SheetOverlayComponent {
7272 public constructor (
7373 private readonly popoverRef : PopoverRef ,
7474 @Inject ( POPOVER_DATA ) sheetData : SheetConstructionData ,
75+ @Inject ( GLOBAL_HEADER_HEIGHT ) globalHeaderHeight : string ,
7576 layoutChange : LayoutChangeService
7677 ) {
7778 const sheetConfig : SheetOverlayConfig = sheetData . config ;
@@ -84,7 +85,7 @@ export class SheetOverlayComponent {
8485
8586 this . isComponentSheet = ! ( sheetConfig . content instanceof TemplateRef ) ;
8687 this . renderer = sheetConfig . content ;
87- this . popoverRef . height ( '100vh' ) ;
88+ this . popoverRef . height ( this . getHeightForPopover ( globalHeaderHeight , sheetConfig . position ) ) ;
8889 this . setWidth ( ) ;
8990 this . navigationParams = sheetConfig . pageNavParams ;
9091 this . rendererInjector = Injector . create ( {
@@ -136,4 +137,8 @@ export class SheetOverlayComponent {
136137 return '100%' ;
137138 }
138139 }
140+
141+ private getHeightForPopover ( globalHeaderHeight : string , position ?: PopoverFixedPositionLocation ) : string {
142+ return position === PopoverFixedPositionLocation . Right ? '100vh' : `calc(100vh - ${ globalHeaderHeight } )` ;
143+ }
139144}
0 commit comments