-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vinhill
committed
Jul 26, 2021
1 parent
5b5d403
commit 2e5e9ad
Showing
12 changed files
with
213 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.card { | ||
margin: 1em; | ||
} | ||
.masonry-item { | ||
float: left; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
<div class="masonry-item col-sm-12 col-md-4"> | ||
<!-- Container for dynamic content from where the tag is used --> | ||
<ng-content></ng-content> | ||
<div class="masonry-item {{classes}}"><!--style="float:left"--> | ||
<div class="card"> | ||
<h5 class="card-header">{{title}}</h5> | ||
<div class="card-body"> | ||
<!-- Container for dynamic content from where the tag is used --> | ||
<ng-content></ng-content> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'card', | ||
templateUrl: './card.component.html', | ||
styleUrls: ['./card.component.css', '../masonry.css'] | ||
styleUrls: ['./card.component.css'] | ||
}) | ||
export class CardComponent {} | ||
export class CardComponent { | ||
@Input() title!: string; | ||
|
||
classes: string = ""; | ||
|
||
constructor() { | ||
// Default value | ||
this.size = "medium"; | ||
} | ||
|
||
@Input() set size(size: string) { | ||
if (size == "tiny") { | ||
this.classes = "col-sm-6 col-md-5 col-lg-4 col-xl-3"; | ||
} else if (size == "small") { | ||
this.classes = "col-sm-12 col-md-6 col-lg-4 col-xl-3"; | ||
} else if (size == "medium") { | ||
this.classes = "col-sm-12 col-md-8 col-lg-6 col-xl-4"; | ||
} else if(size == "large") { | ||
this.classes = "col-sm-12 col-md-12 col-lg-8 col-xl-6"; | ||
}else if (size == "xlarge") { | ||
this.classes = "col-12"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Directive, Input, OnInit, ElementRef } from '@angular/core'; | ||
import { RestttService } from './resttt.service'; | ||
|
||
@Directive({ | ||
selector: '[delay]' | ||
}) | ||
export class DelayDirective implements OnInit { | ||
|
||
constructor(private ref: ElementRef) {} | ||
|
||
@Input() delay!: number; | ||
|
||
ngOnInit() { | ||
setTimeout(() => { | ||
this.invert(); | ||
}, this.delay); | ||
} | ||
|
||
invert() { | ||
if(this.ref.nativeElement.hidden) { | ||
this.fadeIn(); | ||
}else { | ||
this.fadeOut(); | ||
} | ||
} | ||
|
||
// https://stackoverflow.com/questions/6121203/how-to-do-fade-in-and-fade-out-with-javascript-and-css | ||
|
||
fadeOut() { | ||
let element = this.ref.nativeElement; | ||
element.style.opacity = 1; | ||
|
||
var op = 1; // initial opacity | ||
var timer = setInterval(function () { | ||
if (op <= 0.1){ | ||
clearInterval(timer); | ||
element.hidden = true; | ||
} | ||
element.style.opacity = op; | ||
element.style.filter = 'alpha(opacity=' + op * 100 + ")"; | ||
op -= op * 0.1; | ||
}, 50); | ||
} | ||
|
||
fadeIn() { | ||
let element = this.ref.nativeElement; | ||
element.style.opacity = 0; | ||
element.hidden = false; | ||
|
||
var op = 0.05; // initial opacity | ||
var timer = setInterval(function () { | ||
if (op >= 1){ | ||
clearInterval(timer); | ||
} | ||
element.style.opacity = op; | ||
element.style.filter = 'alpha(opacity=' + op * 100 + ")"; | ||
op += op * 0.1; | ||
}, 30); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
<div id="content-wrap" class="container"> | ||
<h1>{{name}}</h1> | ||
<div class="d-flex justify-content-center"> | ||
<h1 class="display-3">{{name}}</h1> | ||
</div> | ||
<div dataMasonry='{ "itemSelector": ".masonry-item" }'> | ||
|
||
<card>Hello, World!</card> | ||
<card title="Rollen"> | ||
<resttt query="PlayerRoles/{{name}}" display="chart" label="role" data="count" type="doughnut"></resttt> | ||
</card> | ||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.btn-reload { | ||
height: 3rem; | ||
margin-top: 0.5rem; | ||
margin-bottom: 0.5rem; | ||
} | ||
.spinner-border { | ||
width: 5rem; | ||
height: 5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,58 @@ | ||
<div *ngIf="loaded"> | ||
|
||
<!-- Text --> | ||
<div *ngIf="display == 'text'"> | ||
{{stringify(result)}} | ||
</div> | ||
|
||
<!-- Table --> | ||
<div *ngIf="display == 'table'"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th *ngFor="let key of keys(result[0])">{{key}}</th> | ||
<th *ngFor="let key of columns">{{key}}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let row of result"> | ||
<td *ngFor="let key of keys(result[0])">{{row[key]}}</td> | ||
<td *ngFor="let key of columns">{{row[key]}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<!-- Chart --> | ||
<div *ngIf="display == 'chart'"> | ||
To be implemented... | ||
<canvas baseChart *ngIf="data != ''" | ||
[data]="get_column(data)" | ||
[labels]="get_column(label)" | ||
[chartType]="type" | ||
[legend]="legend" | ||
[options]="options"> | ||
</canvas> | ||
<canvas baseChart *ngIf="datas.length != 0" | ||
[data]="get_columns(datas)" | ||
[labels]="get_column(label)" | ||
[chartType]="type" | ||
[legend]="legend" | ||
[options]="options"> | ||
</canvas> | ||
</div> | ||
</div> | ||
|
||
<!-- Loading --> | ||
<div *ngIf="!loaded"> | ||
<div class="spinner-border text-success" role="status"> | ||
<span class="sr-only">Loading...</span> | ||
<div class="row"> | ||
<div class="col-4"></div> | ||
<div class="col-4"> | ||
<div class="d-flex justify-content-center"> | ||
<div class="spinner-border text-secondary" role="status"></div> | ||
</div> | ||
</div> | ||
<div class="col-4"> | ||
<div class="d-flex flex-row-reverse"> | ||
<button type="button" class="btn btn-secondary btn-reload" (click)="load()" [delay]="2500" hidden>Reload</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters