Skip to content

Commit

Permalink
Implementada solução para tornar as dashboards mais confortáveis em t…
Browse files Browse the repository at this point in the history
…elas menores
  • Loading branch information
FelipeMarques06 committed Feb 2, 2022
1 parent ac61b85 commit 5cbde6b
Show file tree
Hide file tree
Showing 17 changed files with 81 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/app/biblioteconomia/abnt/abnt.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</button>
<span>NORMAS TÉCNICAS ABNT</span>
</mat-toolbar>
<mat-grid-list cols="2" rowHeight="300px">
<mat-grid-list [cols]="breakpoint" rowHeight="300px" (window:resize)="handleSize($event)">
<mat-grid-tile class="container" *ngFor="let card of cards$ | async" [colspan]="card.cols" [rowspan]="card.rows">
<mat-card class="dashboard-card">
<mat-card-header>
Expand Down
9 changes: 9 additions & 0 deletions src/app/biblioteconomia/abnt/abnt.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AbntService } from './../services/abnt.service';
export class AbntComponent {

cards$: Observable<ABNT[]>;
breakpoint!: number;
usuario$= this.autenticacaoFirebaseService.usuarioLogado$;
cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
Expand All @@ -37,4 +38,12 @@ export class AbntComponent {
})
)
}

ngOnInit(): void {
this.breakpoint = (window.innerWidth <= 600) ? 1 : 2;
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 600) ? 1 : 2;
}
}
2 changes: 1 addition & 1 deletion src/app/biblioteconomia/basedados/basedados.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span>BASES DE DADOS DE BIBLIOTECONOMIA</span>
</mat-toolbar>
<h2 class="mat-h2">Estas são algumas Bases de Dados na área de Biblioteconomia:</h2>
<mat-grid-list cols="2" rowHeight="300px">
<mat-grid-list [cols]="breakpoint" rowHeight="300px" (window:resize)="handleSize($event)">
<mat-grid-tile class="container" *ngFor="let card of cards$ | async" [colspan]="card.cols" [rowspan]="card.rows">
<mat-card class="dashboard-card">
<mat-card-header>
Expand Down
9 changes: 9 additions & 0 deletions src/app/biblioteconomia/basedados/basedados.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { BasedadosService } from './../services/basedados.service';
export class BasedadosComponent {

cards$: Observable<BaseDados[]>;
breakpoint!: number;
usuario$= this.autenticacaoFirebaseService.usuarioLogado$;
cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
Expand All @@ -37,4 +38,12 @@ export class BasedadosComponent {
})
)
}

ngOnInit(): void {
this.breakpoint = (window.innerWidth <= 600) ? 1 : 2;
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 600) ? 1 : 2;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</mat-toolbar>
<h2 class="mat-h2">Estas são algumas das principais bibliotecas virtuais disponíveis nas plataformas digitais:</h2>

<mat-grid-list cols="2" rowHeight="180px">
<mat-grid-list [cols]="breakpoint" rowHeight="180px" (window:resize)="handleSize($event)">
<mat-grid-tile class="container" *ngFor="let card of cards$ | async" [colspan]="card.cols" [rowspan]="card.rows">
<mat-card class="dashboard-card">
<mat-card-header>
Expand Down
9 changes: 9 additions & 0 deletions src/app/biblioteconomia/bibvirtuais/bibvirtuais.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Component, OnInit } from '@angular/core';
export class BibvirtuaisComponent {

cards$: Observable<BibliotecasVirtuais[]>;
breakpoint!: number;
usuario$= this.autenticacaoFirebaseService.usuarioLogado$;
cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
Expand All @@ -37,4 +38,12 @@ export class BibvirtuaisComponent {
)
}

ngOnInit(): void {
this.breakpoint = (window.innerWidth <= 600) ? 1 : 2;
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 600) ? 1 : 2;
}

}
6 changes: 3 additions & 3 deletions src/app/criticas/critica/critica.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</mat-form-field>
</div>
<div class="grid-container" *ngIf="result$ | async as busca">
<mat-grid-list cols="2" rowHeight="200px">
<mat-grid-tile *ngFor="let busca of result$| async" [colspan]="busca.cols" [rowspan]="busca.rows">
<mat-grid-list [cols]="breakpoint" rowHeight="200px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let busca of result$| async" [colspan]="busca.cols" [rowspan]="busca.rows">
<mat-card class="dashboard-card">
<mat-card-title-group>
<mat-card-title>{{busca.titulo}}</mat-card-title>
Expand All @@ -36,7 +36,7 @@
</button>
<span>NORMAS TÉCNICAS ABNT</span>
</mat-toolbar>
<mat-grid-list cols="2" rowHeight="200px">
<mat-grid-list [cols]="breakpoint" rowHeight="200px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let critica of criticas$ | async" [colspan]="critica.cols" [rowspan]="critica.rows">
<mat-card class="dashboard-card">
<mat-card-title-group>
Expand Down
6 changes: 6 additions & 0 deletions src/app/criticas/critica/critica.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class CriticaComponent {
criticas$: Observable<Critica[]>;
result$?: Observable<Critica[]>
value!: string;
breakpoint!: number;

criticas= this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
Expand All @@ -42,6 +43,7 @@ export class CriticaComponent {
@ViewChild('searchInput') searchInput!: ElementRef

ngAfterViewInit(): void {
this.breakpoint = (window.innerWidth <= 600) ? 1 : 2;
fromEvent(this.searchInput.nativeElement, 'keyup').pipe(
filter(Boolean),
debounceTime(400),
Expand All @@ -64,4 +66,8 @@ export class CriticaComponent {
data: resenha
})
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 600) ? 1 : 2;
}
}
31 changes: 3 additions & 28 deletions src/app/feed/feed.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<div *ngIf="results$ | async as search">
<mat-grid-list cols="2" rowHeight="350px">
<mat-grid-list [cols]="breakpoint" rowHeight="350px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let result of results$ | async" [colspan]="result.cols" [rowspan]="result.rows">
<mat-card class="dashboard-card">
<mat-card-header>
Expand Down Expand Up @@ -41,33 +41,8 @@ <h1 class="mat-h1" *ngIf="usuario$ | async as usuario">Bem vindo(a), {{usuario.d

</form>

<mat-grid-list cols="2" rowHeight="350px">
<mat-grid-tile *ngFor="let card of cards$ | async" [colspan]="card.cols" [rowspan]="card.rows">
<mat-card class="dashboard-card">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
<mat-card-title>{{card.titulo}}</mat-card-title>
<mat-card-subtitle>{{card.subtitulo}}</mat-card-subtitle>
</mat-card-header>
<img mat-card-image [src]="card.img" [alt]="card.titulo">
<mat-card-content class="dashboard-card-content">
<div>{{card.conteudo}}</div>
</mat-card-content>
<mat-nav-list>
<mat-list-item *ngFor="let link of card.link">
<a matLine [href]="link.ref">{{ link.texto }}</a>
<button mat-icon-button matTooltip="Mais informações">
<mat-icon>info</mat-icon>
</button>
<mat-divider></mat-divider>
</mat-list-item>
</mat-nav-list>
</mat-card>
</mat-grid-tile>
</mat-grid-list>

<mat-grid-list cols="2" rowHeight="350px">
<mat-grid-tile *ngFor="let card of cards$ | async" [colspan]="card.cols" [rowspan]="card.rows">
<mat-grid-list [cols]="breakpoint" rowHeight="350px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let card of cards$ | async" [rowspan]="card.rows">
<mat-card class="dashboard-card">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
Expand Down
6 changes: 6 additions & 0 deletions src/app/feed/feed.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class FeedComponent implements OnInit, AfterViewInit{
value!: string;
formulario!: FormGroup;
cards$: Observable<Dashboard[]>;
breakpoint!: number;
usuario$= this.autenticacaoFirebaseService.usuarioLogado$;
cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
Expand All @@ -30,6 +31,7 @@ export class FeedComponent implements OnInit, AfterViewInit{
@ViewChild('searchInput') searchInput!: ElementRef

ngOnInit(): void {
this.breakpoint = (window.innerWidth <= 600) ? 1 : 2;
this.formulario = new FormGroup({
titulo: new FormControl('')
})
Expand Down Expand Up @@ -68,4 +70,8 @@ export class FeedComponent implements OnInit, AfterViewInit{
.subscribe();
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 600) ? 1 : 2;
}

}
2 changes: 1 addition & 1 deletion src/app/reportagem/reportagem.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
apelo por bem estar pessoal, criatividade e autoconhecimento. A literatura brasileira é rica de grandes
obras escritas por artistas consagrados e reconhecidos mundialmente.
</mat-card>
<mat-grid-list cols="2" rowHeight="350px">
<mat-grid-list [cols]="breakpoint" rowHeight="350px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let reportagem of reportagem$ | async" [colspan]="reportagem.cols" [rowspan]="reportagem.rows">
<mat-card class="reportagem-card">
<img mat-card-image [src]="reportagem.img" alt="Livros">
Expand Down
11 changes: 10 additions & 1 deletion src/app/reportagem/reportagem.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { catchError, Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';

Expand All @@ -16,6 +16,7 @@ export class ReportagemComponent {

reportagem$: Observable<Reportagem[]>;
usuario$= this.autenticacaoFirebaseService.usuarioLogado$;
breakpoint!: number;
reportagens= this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
if (matches) {
Expand All @@ -37,4 +38,12 @@ export class ReportagemComponent {
})
)
}

ngOnInit(): void {
this.breakpoint = (window.innerWidth <= 600) ? 1 : 2;
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 600) ? 1 : 2;
}
}
8 changes: 4 additions & 4 deletions src/app/sagas/sagas.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</mat-form-field>
</div>
<div class="grid-container" *ngIf="result$ | async as busca">
<mat-grid-list cols="2" rowHeight="250px">
<mat-grid-tile *ngFor="let busca of result$| async" [colspan]="busca.cols" [rowspan]="busca.rows">
<mat-grid-list [cols]="breakpoint" rowHeight="250px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let busca of result$| async">
<mat-card class="dashboard-card">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
Expand All @@ -34,8 +34,8 @@
</button>
<span>AS 10 SAGAS LITERÁRIAS MAIS FAMOSAS</span>
</mat-toolbar>
<mat-grid-list cols="2" rowHeight="250px">
<mat-grid-tile *ngFor="let sagas of sagas$ | async" [colspan]="sagas.cols" [rowspan]="sagas.rows">
<mat-grid-list [cols]="breakpoint" rowHeight="250px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let sagas of sagas$ | async">
<mat-card class="dashboard-card">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
Expand Down
7 changes: 6 additions & 1 deletion src/app/sagas/sagas.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { catchError, fromEvent, Observable,filter, debounceTime, distinctUntilCh
import { SagasService } from '../servicosInterface/sagas.service';
import { map } from 'rxjs/operators';
import { SagasDialogoComponent } from '../sagas-dialogo/sagas-dialogo.component';
import { ConnectedOverlayPositionChange } from '@angular/cdk/overlay';

@Component({
selector: 'app-sagas',
Expand All @@ -18,6 +17,7 @@ export class SagasComponent implements AfterViewInit {
sagas$: Observable<Sagas[]>;
result$?: Observable<Sagas[]>
value!: string;
breakpoint!: number;

sagas= this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
Expand All @@ -44,6 +44,7 @@ export class SagasComponent implements AfterViewInit {
@ViewChild('searchInput') searchInput!: ElementRef

ngAfterViewInit(): void {
this.breakpoint = (window.innerWidth <= 700) ? 1 : 2;
fromEvent(this.searchInput.nativeElement, 'keyup').pipe(
filter(Boolean),
debounceTime(400),
Expand All @@ -61,6 +62,10 @@ export class SagasComponent implements AfterViewInit {
).subscribe()
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 700) ? 1 : 2;
}

abrirSagas(livros: [{nome:string}]){
this.telaSagas.open(SagasDialogoComponent,{
data: livros
Expand Down
8 changes: 4 additions & 4 deletions src/app/sugestoes/sugestoes.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</mat-form-field>
</div>
<div class="grid-container" *ngIf="result$ | async as busca">
<mat-grid-list cols="2" rowHeight="180px">
<mat-grid-tile *ngFor="let busca of result$ | async" [colspan]="busca.cols" [rowspan]="busca.rows">
<mat-grid-list [cols]="breakpoint" rowHeight="180px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let busca of result$ | async">
<mat-card class="dashboard-card">
<mat-card-header>
<mat-card-title>{{busca.titulo}}</mat-card-title>
Expand All @@ -32,8 +32,8 @@
</button>
<span>SUGESTÕES DE LIVROS</span>
</mat-toolbar>
<mat-grid-list cols="2" rowHeight="180px">
<mat-grid-tile *ngFor="let card of cards$ | async" [colspan]="card.cols" [rowspan]="card.rows">
<mat-grid-list [cols]="breakpoint" rowHeight="180px" (window:resize)="handleSize($event)">
<mat-grid-tile *ngFor="let card of cards$ | async">
<mat-card class="dashboard-card">
<mat-card-header>
<!-- <div mat-card-avatar class="example-header-image"></div> -->
Expand Down
6 changes: 6 additions & 0 deletions src/app/sugestoes/sugestoes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class SugestoesComponent {
cards$: Observable <Sugestoes[]>;
result$?: Observable<Sugestoes[]>
value!: string;
breakpoint!: number;

cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(({ matches }) => {
Expand All @@ -42,6 +43,7 @@ export class SugestoesComponent {
@ViewChild('searchInput') searchInput!: ElementRef

ngAfterViewInit(): void {
this.breakpoint = (window.innerWidth <= 600) ? 1 : 2;
fromEvent(this.searchInput.nativeElement, 'keyup').pipe(
filter(Boolean),
debounceTime(400),
Expand All @@ -58,4 +60,8 @@ export class SugestoesComponent {
})
).subscribe()
}

handleSize(event: any) {
this.breakpoint = (event.target.innerWidth <= 600) ? 1 : 2;
}
}
4 changes: 2 additions & 2 deletions src/assets/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
{"ref":"https://www.theenemy.com.br/social/criticas/review-the-witcher-temporada-2#:~:text=Honestamente%2C%20a%20breve%20apari%C3%A7%C3%A3o%20da,Ciri%20em%20termos%20de%20magia.", "texto":"The Enemy"},
{"ref":"https://jovemnerd.com.br/nerdbunker/the-witcher-vale-a-pena-os-livros/","texto":"Jovem Nerd"}
],
"cols": 2,
"rows": 3
"cols": 1,
"rows": 2
},
{
"titulo": "Dica de Livros: Ler e Pensar",
Expand Down

0 comments on commit 5cbde6b

Please sign in to comment.