Resize docs code templates on open (mobile)
This commit is contained in:
		
							parent
							
								
									838725a862
								
							
						
					
					
						commit
						4c8ac3a585
					
				| @ -79,11 +79,7 @@ export class ApiDocsComponent implements OnInit { | ||||
|   } | ||||
|    | ||||
|   openEndpointContainer( targetId ) { | ||||
|    | ||||
|     if( window.innerWidth > 992 ) { | ||||
|       return; | ||||
|     } | ||||
|      | ||||
|     if( window.innerWidth <= 992 ) { | ||||
|       const endpointContainerEl = document.querySelector<HTMLElement>( "#" + targetId ); | ||||
|       const endpointContentEl = document.querySelector<HTMLElement>( "#" + targetId + " .endpoint-content" ); | ||||
|       const endPointContentElHeight = endpointContentEl.clientHeight; | ||||
| @ -99,7 +95,7 @@ export class ApiDocsComponent implements OnInit { | ||||
|         endpointContentEl.style.opacity = "1"; | ||||
|         endpointContentEl.classList.add( "open" ); | ||||
|       } | ||||
|      | ||||
|     }   | ||||
|   } | ||||
| 
 | ||||
|   wrapUrl(network: string, code: any, websocket: boolean = false) { | ||||
|  | ||||
| @ -1,14 +1,14 @@ | ||||
| <div class="code"> | ||||
|   <ul ngbNav #navCodeTemplate="ngbNav" class="nav-tabs code-tab"> | ||||
|     <li ngbNavItem *ngIf="code.codeTemplate.curl && method !== 'websocket'"> | ||||
|       <a ngbNavLink>cURL</a> | ||||
|       <a ngbNavLink (click)="adjustContainerHeight( $event )">cURL</a> | ||||
|       <ng-template ngbNavContent> | ||||
|         <div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapCurlTemplate(code)"></app-clipboard></div> | ||||
|         <pre><code [innerText]="wrapCurlTemplate(code)"></code></pre> | ||||
|       </ng-template> | ||||
|     </li> | ||||
|     <li ngbNavItem *ngIf="network !== 'liquidtestnet'"> | ||||
|       <a ngbNavLink>CommonJS</a> | ||||
|       <a ngbNavLink (click)="adjustContainerHeight( $event )" >CommonJS</a> | ||||
|       <ng-template ngbNavContent> | ||||
|         <div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapCommonJS(code)"></app-clipboard></div> | ||||
|         <div class="links"> | ||||
| @ -18,7 +18,7 @@ | ||||
|       </ng-template> | ||||
|     </li> | ||||
|     <li ngbNavItem> | ||||
|       <a ngbNavLink *ngIf="network !== 'liquidtestnet'">ES Module</a> | ||||
|       <a ngbNavLink (click)="adjustContainerHeight( $event )" *ngIf="network !== 'liquidtestnet'">ES Module</a> | ||||
|       <ng-template ngbNavContent> | ||||
|         <div class="subtitle"><ng-container i18n="API Docs install lib">Install Package</ng-container> <app-clipboard [text]="wrapImportTemplate()"></app-clipboard></div> | ||||
|         <div class="links"> | ||||
|  | ||||
| @ -22,6 +22,17 @@ export class CodeTemplateComponent implements OnInit { | ||||
|     this.env = this.stateService.env; | ||||
|   } | ||||
|    | ||||
|   adjustContainerHeight( event ) { | ||||
|     if( window.innerWidth <= 992 ) { | ||||
|       const urlObj = new URL( window.location + "" ); | ||||
|       const endpointContainerEl = document.querySelector<HTMLElement>( urlObj.hash ); | ||||
|       const endpointContentEl = document.querySelector<HTMLElement>( urlObj.hash + " .endpoint-content" ); | ||||
|       window.setTimeout( function() { | ||||
|         endpointContainerEl.style.height = endpointContentEl.clientHeight + 90 + "px"; | ||||
|       }, 400); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   npmGithubLink(){ | ||||
|     let npmLink = `https://github.com/mempool/mempool.js`; | ||||
|     if (this.network === 'bisq') { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user