From 58ccf3938d8b043e1fea85fdd476161d0c38171e Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sat, 7 Jan 2017 18:23:08 +0200 Subject: [PATCH] Move some templates + css into separate files --- lib/components/LoadingBar/loading-bar.scss | 21 +++++++++++++++ lib/components/LoadingBar/loading-bar.ts | 24 +---------------- lib/shared/components/DropDown/drop-down.html | 3 +++ lib/shared/components/DropDown/drop-down.ts | 6 +---- lib/shared/components/Tabs/tab.html | 3 +++ lib/shared/components/Tabs/tab.scss | 10 +++++++ lib/shared/components/Tabs/tabs.html | 5 ++++ lib/shared/components/Tabs/tabs.ts | 27 +++---------------- 8 files changed, 47 insertions(+), 52 deletions(-) create mode 100644 lib/components/LoadingBar/loading-bar.scss create mode 100644 lib/shared/components/DropDown/drop-down.html create mode 100644 lib/shared/components/Tabs/tab.html create mode 100644 lib/shared/components/Tabs/tab.scss create mode 100644 lib/shared/components/Tabs/tabs.html diff --git a/lib/components/LoadingBar/loading-bar.scss b/lib/components/LoadingBar/loading-bar.scss new file mode 100644 index 00000000..421e7dfb --- /dev/null +++ b/lib/components/LoadingBar/loading-bar.scss @@ -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; +} diff --git a/lib/components/LoadingBar/loading-bar.ts b/lib/components/LoadingBar/loading-bar.ts index 55702822..7b90a4bf 100644 --- a/lib/components/LoadingBar/loading-bar.ts +++ b/lib/components/LoadingBar/loading-bar.ts @@ -6,29 +6,7 @@ import { Input, HostBinding, Component, OnChanges } from '@angular/core'; template: ` `, - 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; diff --git a/lib/shared/components/DropDown/drop-down.html b/lib/shared/components/DropDown/drop-down.html new file mode 100644 index 00000000..e8f62bef --- /dev/null +++ b/lib/shared/components/DropDown/drop-down.html @@ -0,0 +1,3 @@ + diff --git a/lib/shared/components/DropDown/drop-down.ts b/lib/shared/components/DropDown/drop-down.ts index 71ee4494..5e3e920b 100644 --- a/lib/shared/components/DropDown/drop-down.ts +++ b/lib/shared/components/DropDown/drop-down.ts @@ -5,11 +5,7 @@ import * as DropKick from 'dropkickjs'; @Component({ selector: 'drop-down', - template: ` - - `, + templateUrl: 'drop-down.html', styleUrls: ['./drop-down.css'] }) export class DropDown implements AfterContentInit { diff --git a/lib/shared/components/Tabs/tab.html b/lib/shared/components/Tabs/tab.html new file mode 100644 index 00000000..3b0afa5c --- /dev/null +++ b/lib/shared/components/Tabs/tab.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/lib/shared/components/Tabs/tab.scss b/lib/shared/components/Tabs/tab.scss new file mode 100644 index 00000000..8791f601 --- /dev/null +++ b/lib/shared/components/Tabs/tab.scss @@ -0,0 +1,10 @@ +:host { + display: block; +} +.tab-wrap { + display: none; +} + +.tab-wrap.active { + display: block; +} diff --git a/lib/shared/components/Tabs/tabs.html b/lib/shared/components/Tabs/tabs.html new file mode 100644 index 00000000..edb1c5bf --- /dev/null +++ b/lib/shared/components/Tabs/tabs.html @@ -0,0 +1,5 @@ + + diff --git a/lib/shared/components/Tabs/tabs.ts b/lib/shared/components/Tabs/tabs.ts index deeea063..a99b9288 100644 --- a/lib/shared/components/Tabs/tabs.ts +++ b/lib/shared/components/Tabs/tabs.ts @@ -5,13 +5,7 @@ import { ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core'; @Component({ selector: 'tabs', - template: ` - - - `, + templateUrl: 'tabs.html', styleUrls: ['tabs.css'], changeDetection: ChangeDetectionStrategy.OnPush }) @@ -63,23 +57,8 @@ export class Tabs implements OnInit { @Component({ selector: 'tab', - template: ` -
- -
- `, - 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;