Move some templates + css into separate files

This commit is contained in:
Roman Hotsiy 2017-01-07 18:23:08 +02:00
parent 899c2b8398
commit 58ccf3938d
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
8 changed files with 47 additions and 52 deletions

View File

@ -0,0 +1,21 @@
:host {
position: fixed;
top: 0;
left: 0;
right: 0;
display: block;
height: 5px;
z-index: 100;
}
span {
display: block;
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: attr(progress percentage);
background-color: #5f7fc3;
transition: right 0.2s linear;
}

View File

@ -6,29 +6,7 @@ import { Input, HostBinding, Component, OnChanges } from '@angular/core';
template: `
<span [style.width]='progress + "%"'> </span>
`,
styles: [`
:host {
position: fixed;
top: 0;
left: 0;
right: 0;
display: block;
height: 5px;
z-index: 100;
}
span {
display: block;
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: attr(progress percentage);
background-color: #5f7fc3;
transition: right 0.2s linear;
}
`]
styleUrls: ['loading-bar.scss']
})
export class LoadingBar implements OnChanges {
@Input() progress:number = 0;

View File

@ -0,0 +1,3 @@
<select (change)=onChange($event.target.value)>
<ng-content></ng-content>
</select>

View File

@ -5,11 +5,7 @@ import * as DropKick from 'dropkickjs';
@Component({
selector: 'drop-down',
template: `
<select (change)=onChange($event.target.value)>
<ng-content></ng-content>
</select>
`,
templateUrl: 'drop-down.html',
styleUrls: ['./drop-down.css']
})
export class DropDown implements AfterContentInit {

View File

@ -0,0 +1,3 @@
<div class="tab-wrap" [ngClass]="{'active': active}">
<ng-content></ng-content>
</div>

View File

@ -0,0 +1,10 @@
:host {
display: block;
}
.tab-wrap {
display: none;
}
.tab-wrap.active {
display: block;
}

View File

@ -0,0 +1,5 @@
<ul>
<li *ngFor="let tab of tabs" [ngClass]="{active: tab.active}" (click)="selectTab(tab)"
class="tab-{{tab.tabStatus}}">{{tab.tabTitle}}</li>
</ul>
<ng-content></ng-content>

View File

@ -5,13 +5,7 @@ import { ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'tabs',
template: `
<ul>
<li *ngFor="let tab of tabs" [ngClass]="{active: tab.active}" (click)="selectTab(tab)"
class="tab-{{tab.tabStatus}}">{{tab.tabTitle}}</li>
</ul>
<ng-content></ng-content>
`,
templateUrl: 'tabs.html',
styleUrls: ['tabs.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
@ -63,23 +57,8 @@ export class Tabs implements OnInit {
@Component({
selector: 'tab',
template: `
<div class="tab-wrap" [ngClass]="{'active': active}">
<ng-content></ng-content>
</div>
`,
styles: [`
:host {
display: block;
}
.tab-wrap {
display: none;
}
.tab-wrap.active {
display: block;
}`
]
templateUrl: 'tab.html',
styleUrls: ['tab.css']
})
export class Tab {
@Input() active: boolean = false;