forked from EVOgeek/Vmeda.Online
		
	Merge pull request #3131 from dpalou/MOBILE-3927
MOBILE-3927 swipe: Make swipe-slides fill whole height
This commit is contained in:
		
						commit
						04d2bcfe85
					
				| @ -7,7 +7,8 @@ | |||||||
|     </core-context-menu> |     </core-context-menu> | ||||||
| </core-navbar-buttons> | </core-navbar-buttons> | ||||||
| 
 | 
 | ||||||
| <core-loading [hideUntil]="loaded" class="safe-area-padding"> | <core-loading [hideUntil]="loaded" class="safe-area-padding core-loading-full-height"> | ||||||
|  |     <div class="core-swipe-slides-container"> | ||||||
|         <!-- Period name and arrows to navigate. --> |         <!-- Period name and arrows to navigate. --> | ||||||
|         <ion-grid class="ion-no-padding addon-calendar-navigation"> |         <ion-grid class="ion-no-padding addon-calendar-navigation"> | ||||||
|             <ion-row class="ion-align-items-center"> |             <ion-row class="ion-align-items-center"> | ||||||
| @ -104,5 +105,6 @@ | |||||||
|                 </ion-grid> |                 </ion-grid> | ||||||
|             </ng-template> |             </ng-template> | ||||||
|         </core-swipe-slides> |         </core-swipe-slides> | ||||||
|  |     </div> | ||||||
| 
 | 
 | ||||||
| </core-loading> | </core-loading> | ||||||
|  | |||||||
| @ -3,6 +3,11 @@ | |||||||
| :host { | :host { | ||||||
|     --addon-calendar-blank-day-background-color: var(--light); |     --addon-calendar-blank-day-background-color: var(--light); | ||||||
| 
 | 
 | ||||||
|  |     .core-swipe-slides-container ion-grid { | ||||||
|  |         flex: none; | ||||||
|  |         width: 100%; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     .addon-calendar-navigation { |     .addon-calendar-navigation { | ||||||
|         padding-top: 5px; |         padding-top: 5px; | ||||||
|         padding-left: 10px; |         padding-left: 10px; | ||||||
|  | |||||||
| @ -27,7 +27,8 @@ | |||||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> |         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||||
|     </ion-refresher> |     </ion-refresher> | ||||||
| 
 | 
 | ||||||
|     <core-loading [hideUntil]="loaded"> |     <core-loading [hideUntil]="loaded" class="core-loading-full-height"> | ||||||
|  |         <div class="core-swipe-slides-container"> | ||||||
|             <!-- Period name and arrows to navigate. --> |             <!-- Period name and arrows to navigate. --> | ||||||
|             <ion-grid class="ion-no-padding safe-area-padding"> |             <ion-grid class="ion-no-padding safe-area-padding"> | ||||||
|                 <ion-row class="ion-align-items-center"> |                 <ion-row class="ion-align-items-center"> | ||||||
| @ -99,6 +100,7 @@ | |||||||
|                     </core-loading> |                     </core-loading> | ||||||
|                 </ng-template> |                 </ng-template> | ||||||
|             </core-swipe-slides> |             </core-swipe-slides> | ||||||
|  |         </div> | ||||||
|     </core-loading> |     </core-loading> | ||||||
| 
 | 
 | ||||||
|     <!-- Create a calendar event. --> |     <!-- Create a calendar event. --> | ||||||
|  | |||||||
| @ -1,4 +1,9 @@ | |||||||
| :host { | :host { | ||||||
|  |     .core-swipe-slides-container ion-grid { | ||||||
|  |         flex: none; | ||||||
|  |         width: 100%; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     .addon-calendar-period { |     .addon-calendar-period { | ||||||
|         flex-grow: 3; |         flex-grow: 3; | ||||||
|         h3 { |         h3 { | ||||||
| @ -6,8 +11,4 @@ | |||||||
|             font-size: 1.2rem; |             font-size: 1.2rem; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     core-swipe-slides { |  | ||||||
|         --swipe-slides-min-height: calc(100% - 52px); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -21,7 +21,8 @@ | |||||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> |         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||||
|     </ion-refresher> |     </ion-refresher> | ||||||
| 
 | 
 | ||||||
|     <core-loading [hideUntil]="loaded"> |     <core-loading [hideUntil]="loaded" class="core-loading-full-height"> | ||||||
|  |         <div class="safe-area-padding-horizontal core-swipe-slides-container"> | ||||||
| 
 | 
 | ||||||
|             <ion-card class="core-warning-card" *ngIf="warning"> |             <ion-card class="core-warning-card" *ngIf="warning"> | ||||||
|                 <ion-item> |                 <ion-item> | ||||||
| @ -30,7 +31,6 @@ | |||||||
|                 </ion-item> |                 </ion-item> | ||||||
|             </ion-card> |             </ion-card> | ||||||
| 
 | 
 | ||||||
|         <div class="safe-area-padding-horizontal"> |  | ||||||
|             <core-navigation-bar *ngIf="displayNavBar" [items]="navigationItems" [showTitles]="displayTitlesInNavBar" |             <core-navigation-bar *ngIf="displayNavBar" [items]="navigationItems" [showTitles]="displayTitlesInNavBar" | ||||||
|                 previousTranslate="addon.mod_book.navprevtitle" nextTranslate="addon.mod_book.navnexttitle" |                 previousTranslate="addon.mod_book.navprevtitle" nextTranslate="addon.mod_book.navnexttitle" | ||||||
|                 (action)="changeChapter($event.id)"> |                 (action)="changeChapter($event.id)"> | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								src/addons/mod/book/pages/contents/contents.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/addons/mod/book/pages/contents/contents.scss
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | :host { | ||||||
|  |     .core-swipe-slides-container { | ||||||
|  |         ion-card, core-navigation-bar { | ||||||
|  |             flex: none; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -47,6 +47,7 @@ import { | |||||||
| @Component({ | @Component({ | ||||||
|     selector: 'page-addon-mod-book-contents', |     selector: 'page-addon-mod-book-contents', | ||||||
|     templateUrl: 'contents.html', |     templateUrl: 'contents.html', | ||||||
|  |     styleUrls: ['contents.scss'], | ||||||
| }) | }) | ||||||
| export class AddonModBookContentsPage implements OnInit, OnDestroy { | export class AddonModBookContentsPage implements OnInit, OnDestroy { | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -71,6 +71,10 @@ | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     &.core-loading-full-height .core-loading-content { | ||||||
|  |         height: 100%; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     &.safe-area-padding:not(.core-loading-inline) .core-loading-content, |     &.safe-area-padding:not(.core-loading-inline) .core-loading-content, | ||||||
|     &.safe-area-padding-horizontal:not(.core-loading-inline) .core-loading-content { |     &.safe-area-padding-horizontal:not(.core-loading-inline) .core-loading-content { | ||||||
|         @include safe-area-padding-horizontal(0px, 0px); |         @include safe-area-padding-horizontal(0px, 0px); | ||||||
|  | |||||||
| @ -1,8 +1,6 @@ | |||||||
| :host { | :host { | ||||||
|     --swipe-slides-min-height: auto; |  | ||||||
| 
 |  | ||||||
|     ion-slides { |     ion-slides { | ||||||
|         min-height: var(--swipe-slides-min-height); |         height: 100%; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ion-slide { |     ion-slide { | ||||||
|  | |||||||
| @ -181,17 +181,8 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe | |||||||
| 
 | 
 | ||||||
|         this.onWillChange.emit(currentItemData); |         this.onWillChange.emit(currentItemData); | ||||||
| 
 | 
 | ||||||
|         if (this.options.scrollOnChange !== 'top') { |         // Apply scroll on change. In some devices it's too soon to do it, that's why it's done again in DidChange.
 | ||||||
|             return; |         await this.applyScrollOnChange(); | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         // Scroll top. This can be improved in the future to keep the scroll for each slide.
 |  | ||||||
|         const scrollElement = await this.content?.getScrollElement(); |  | ||||||
| 
 |  | ||||||
|         if (!scrollElement || CoreDomUtils.isElementOutsideOfScreen(scrollElement, this.hostElement, VerticalPoint.TOP)) { |  | ||||||
|             // Scroll to top.
 |  | ||||||
|             this.hostElement.scrollIntoView({ behavior: 'smooth' }); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -204,6 +195,27 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.onDidChange.emit(currentItemData); |         this.onDidChange.emit(currentItemData); | ||||||
|  | 
 | ||||||
|  |         await this.applyScrollOnChange(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Treat scroll on change. | ||||||
|  |      * | ||||||
|  |      * @return Promise resolved when done. | ||||||
|  |      */ | ||||||
|  |     protected async applyScrollOnChange(): Promise<void> { | ||||||
|  |         if (this.options.scrollOnChange !== 'top') { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // Scroll top. This can be improved in the future to keep the scroll for each slide.
 | ||||||
|  |         const scrollElement = await this.content?.getScrollElement(); | ||||||
|  | 
 | ||||||
|  |         if (!scrollElement || CoreDomUtils.isElementOutsideOfScreen(scrollElement, this.hostElement, VerticalPoint.TOP)) { | ||||||
|  |             // Scroll to top.
 | ||||||
|  |             this.hostElement.scrollIntoView({ behavior: 'smooth' }); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ | |||||||
|     </ion-toolbar> |     </ion-toolbar> | ||||||
| </ion-header> | </ion-header> | ||||||
| <ion-content> | <ion-content> | ||||||
|     <core-loading [hideUntil]="policyLoaded"> |     <core-loading [hideUntil]="policyLoaded" class="core-loading-full-height"> | ||||||
|         <ion-list *ngIf="sitePolicy"> |         <ion-list *ngIf="sitePolicy"> | ||||||
|             <ion-item class="ion-text-wrap"> |             <ion-item class="ion-text-wrap"> | ||||||
|                 <ion-label> |                 <ion-label> | ||||||
|  | |||||||
| @ -18,9 +18,3 @@ | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 |  | ||||||
| :host core-loading ::ng-deep { |  | ||||||
|     .core-loading-content { |  | ||||||
|         height: 100%; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -1581,3 +1581,14 @@ ion-app.md .collapsible-title h1 { | |||||||
| body.core-iframe-fullscreen ion-content { | body.core-iframe-fullscreen ion-content { | ||||||
|     --offset-top: 0px !important; |     --offset-top: 0px !important; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | // To make core-swipe-slides fill the remaining height. | ||||||
|  | .core-swipe-slides-container { | ||||||
|  |     display: flex; | ||||||
|  |     flex-direction: column; | ||||||
|  |     height: 100%; | ||||||
|  | 
 | ||||||
|  |     core-swipe-slides { | ||||||
|  |         flex-grow: 1; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user