fix media preview for tablet and desktop

This commit is contained in:
tiago.kayaya
2021-12-07 17:25:09 +01:00
parent dc8ecf885a
commit 5846acd629
13 changed files with 214 additions and 25 deletions
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ViewMediaPage } from './view-media.page';
const routes: Routes = [
{
path: '',
component: ViewMediaPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ViewMediaPageRoutingModule {}
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ViewMediaPageRoutingModule } from './view-media-routing.module';
import { ViewMediaPage } from './view-media.page';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
FontAwesomeModule,
ViewMediaPageRoutingModule
],
declarations: [ViewMediaPage]
})
export class ViewMediaPageModule {}
@@ -0,0 +1,22 @@
<ion-header class="ion-no-border" translucent>
<div class="main-header d-flex align-items-center">
<div class= "left cursor-pointer" (click)="close()">
<button class="btn-no-color" (click)="close()">
<fa-icon icon="chevron-left" class="header-top-btn font-awesome-1 font-35"></fa-icon>
</button>
</div>
<div class="middle-container">
<div class="middle">
<ion-label class="title">{{name}}<span class="font-15">, {{_updatedAt | date}}</span>
</ion-label>
</div>
</div>
</div>
</ion-header>
<ion-content fullscreen>
<div class="media d-flex align-items-center justify-center">
<div class="media-content w-100 d-flex align-items-center justify-center">
<img src="{{image}}"/>
</div>
</div>
</ion-content>
@@ -0,0 +1,70 @@
.main-header{
width: 100%; /* 400px */
height: 100%;
font-family: Roboto;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background-color: #fff;
overflow:hidden;
padding: 30px 20px 5px 20px;
color:#000;
transform: translate3d(0, 1px, 0);
.left{
width: fit-content;
float: left;
//font-size: 35px;
overflow: hidden;
.header-top-btn{
background: transparent;
font-size: 25px !important;
font-weight: 100 !important;
/* color: #0782c9; */
color: #42b9fe;
}
}
.middle-container{
overflow: auto;
width:calc(100% - 45px);
height: auto;
.middle{
padding: 0!important;
float: left;
width:calc(100% - 77px);
margin: 0px 0 0 10px;
display: flex;
align-items: center;
.title{
font-size: 25px;
white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis !important;
float: left;
}
}
}
}
.media {
background-color: #ebebeb;
padding: 10px !important;
height: 100% !important;
overflow: auto !important;
.media-content{
height: 100% !important;
overflow: auto !important;
img{
width: fit-content !important;
height: 100% !important;
}
}
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ViewMediaPage } from './view-media.page';
describe('ViewMediaPage', () => {
let component: ViewMediaPage;
let fixture: ComponentFixture<ViewMediaPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ViewMediaPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ViewMediaPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,30 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
@Component({
selector: 'app-view-media',
templateUrl: './view-media.page.html',
styleUrls: ['./view-media.page.scss'],
})
export class ViewMediaPage implements OnInit {
image: any;
name: string
_updatedAt: string
constructor(
private modalController: ModalController,
private navParams:NavParams,
) {
this.image = this.navParams.get('image')
this.name = this.navParams.get('username')
this._updatedAt = this.navParams.get('_updatedAt')
}
ngOnInit() {
}
close(){
this.modalController.dismiss()
}
}