Updated mobile view for dropdown (#717)
Dropdown menu with dynamic positioning
This commit is contained in:
		
							parent
							
								
									e103fb5876
								
							
						
					
					
						commit
						ca13d9109c
					
				| @ -10,11 +10,11 @@ | ||||
|     </ng-container> | ||||
|   </a> | ||||
| 
 | ||||
|   <div ngbDropdown display="dynamic" class="dropdown-container" *ngIf="env.TESTNET_ENABLED || env.SIGNET_ENABLED || env.LIQUID_ENABLED || env.BISQ_ENABLED"> | ||||
|   <div ngbDropdown (window:resize)="onResize($event)" class="dropdown-container" *ngIf="env.TESTNET_ENABLED || env.SIGNET_ENABLED || env.LIQUID_ENABLED || env.BISQ_ENABLED"> | ||||
|     <button ngbDropdownToggle type="button" class="btn btn-secondary dropdown-toggle-split" aria-haspopup="true"> | ||||
|       <img src="./resources/bisq-logo.png" style="width: 25px; height: 25px;" class="mr-1"> | ||||
|     </button> | ||||
|     <div ngbDropdownMenu> | ||||
|     <div ngbDropdownMenu [ngClass]="{'dropdown-menu-right' : isMobile}"> | ||||
|       <a href="https://mempool.space" ngbDropdownItem class="mainnet"><img src="./resources/bitcoin-logo.png" style="width: 30px;" class="mr-1"> Mainnet</a> | ||||
|       <a href="https://mempool.space/signet" ngbDropdownItem *ngIf="env.SIGNET_ENABLED" class="signet"><img src="./resources/signet-logo.png" style="width: 30px;" class="mr-1"> Signet</a> | ||||
|       <a href="https://mempool.space/testnet" ngbDropdownItem *ngIf="env.TESTNET_ENABLED" class="testnet"><img src="./resources/testnet-logo.png" style="width: 30px;" class="mr-1"> Testnet</a> | ||||
|  | ||||
| @ -11,6 +11,7 @@ export class BisqMasterPageComponent implements OnInit { | ||||
|   connectionState$: Observable<number>; | ||||
|   navCollapsed = false; | ||||
|   env: Env; | ||||
|   isMobile = window.innerWidth <= 767.98; | ||||
|    | ||||
|   constructor( | ||||
|     private stateService: StateService, | ||||
| @ -24,4 +25,8 @@ export class BisqMasterPageComponent implements OnInit { | ||||
|   collapse(): void { | ||||
|     this.navCollapsed = !this.navCollapsed; | ||||
|   } | ||||
| 
 | ||||
|   onResize(event: any) { | ||||
|     this.isMobile = window.innerWidth <= 767.98; | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -10,11 +10,11 @@ | ||||
|     </ng-container> | ||||
|   </a> | ||||
| 
 | ||||
|   <div ngbDropdown display="dynamic" class="dropdown-container" *ngIf="env.TESTNET_ENABLED || env.SIGNET_ENABLED || env.LIQUID_ENABLED || env.BISQ_ENABLED"> | ||||
|   <div ngbDropdown (window:resize)="onResize($event)" class="dropdown-container" *ngIf="env.TESTNET_ENABLED || env.SIGNET_ENABLED || env.LIQUID_ENABLED || env.BISQ_ENABLED"> | ||||
|     <button ngbDropdownToggle type="button" class="btn btn-secondary dropdown-toggle-split" aria-haspopup="true"> | ||||
|       <img src="./resources/liquid-logo.png" style="width: 25px; height: 25px;" class="mr-1"> | ||||
|     </button> | ||||
|     <div ngbDropdownMenu> | ||||
|     <div ngbDropdownMenu [ngClass]="{'dropdown-menu-right' : isMobile}"> | ||||
|       <a href="https://mempool.space" ngbDropdownItem class="mainnet"><img src="./resources/bitcoin-logo.png" style="width: 30px;" class="mr-1"> Mainnet</a> | ||||
|       <a href="https://mempool.space/signet" ngbDropdownItem *ngIf="env.SIGNET_ENABLED" class="signet"><img src="./resources/signet-logo.png" style="width: 30px;" class="mr-1"> Signet</a> | ||||
|       <a href="https://mempool.space/testnet" ngbDropdownItem *ngIf="env.TESTNET_ENABLED" class="testnet"><img src="./resources/testnet-logo.png" style="width: 30px;" class="mr-1"> Testnet</a> | ||||
|  | ||||
| @ -26,4 +26,8 @@ export class LiquidMasterPageComponent implements OnInit { | ||||
|   collapse(): void { | ||||
|     this.navCollapsed = !this.navCollapsed; | ||||
|   } | ||||
| 
 | ||||
|   onResize(event: any) { | ||||
|     this.isMobile = window.innerWidth <= 767.98; | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -11,11 +11,11 @@ | ||||
|     </ng-container> | ||||
|   </a> | ||||
| 
 | ||||
|   <div ngbDropdown display="dynamic" class="dropdown-container" *ngIf="env.TESTNET_ENABLED || env.SIGNET_ENABLED || env.LIQUID_ENABLED || env.BISQ_ENABLED"> | ||||
|   <div (window:resize)="onResize($event)" ngbDropdown class="dropdown-container" *ngIf="env.TESTNET_ENABLED || env.SIGNET_ENABLED || env.LIQUID_ENABLED || env.BISQ_ENABLED"> | ||||
|     <button ngbDropdownToggle type="button" class="btn btn-secondary dropdown-toggle-split" aria-haspopup="true"> | ||||
|       <img src="./resources/{{ network.val === '' ? 'bitcoin' : network.val }}-logo.png" style="width: 25px; height: 25px;" class="mr-1"> | ||||
|     </button> | ||||
|     <div ngbDropdownMenu> | ||||
|     <div ngbDropdownMenu [ngClass]="{'dropdown-menu-right' : isMobile}"> | ||||
|       <button ngbDropdownItem class="mainnet" routerLink="/"><img src="./resources/bitcoin-logo.png" style="width: 30px;" class="mr-1"> Mainnet</button> | ||||
|       <button ngbDropdownItem *ngIf="env.SIGNET_ENABLED" class="signet" [class.active]="network.val === 'signet'" routerLink="/signet"><img src="./resources/signet-logo.png" style="width: 30px;" class="mr-1"> Signet</button> | ||||
|       <button ngbDropdownItem *ngIf="env.TESTNET_ENABLED" class="testnet" [class.active]="network.val === 'testnet'" routerLink="/testnet"><img src="./resources/testnet-logo.png" style="width: 30px;" class="mr-1"> Testnet</button> | ||||
|  | ||||
| @ -28,4 +28,8 @@ export class MasterPageComponent implements OnInit { | ||||
|   collapse(): void { | ||||
|     this.navCollapsed = !this.navCollapsed; | ||||
|   } | ||||
| 
 | ||||
|   onResize(event: any) { | ||||
|     this.isMobile = window.innerWidth <= 767.98; | ||||
|   } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user