move empty folder UI into separate component (#202)

* move empty folder UI into separate component

* test fixes
This commit is contained in:
Denys Vuika 2018-02-27 11:06:31 +00:00 committed by GitHub
parent 8d4e6a6604
commit 0b5dc47de9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 119 additions and 54 deletions

View File

@ -51,6 +51,7 @@ import { SearchComponent } from './components/search/search.component';
import { SidenavComponent } from './components/sidenav/sidenav.component'; import { SidenavComponent } from './components/sidenav/sidenav.component';
import { AboutComponent } from './components/about/about.component'; import { AboutComponent } from './components/about/about.component';
import { LocationLinkComponent } from './components/location-link/location-link.component'; import { LocationLinkComponent } from './components/location-link/location-link.component';
import { EmptyFolderComponent } from './components/empty-folder/empty-folder.component';
@NgModule({ @NgModule({
imports: [ imports: [
@ -80,7 +81,8 @@ import { LocationLinkComponent } from './components/location-link/location-link.
TrashcanComponent, TrashcanComponent,
PreviewComponent, PreviewComponent,
AboutComponent, AboutComponent,
LocationLinkComponent LocationLinkComponent,
EmptyFolderComponent
], ],
providers: [ providers: [
{ {

View File

@ -0,0 +1,6 @@
<div class="app-empty-folder">
<mat-icon class="app-empty-folder__icon">{{ icon }}</mat-icon>
<p class="app-empty-folder__title">{{ title | translate }}</p>
<p class="app-empty-folder__subtitle">{{ subtitle | translate }}</p>
<ng-content></ng-content>
</div>

View File

@ -0,0 +1,29 @@
@import 'variables';
.app-empty-folder {
color: $alfresco-secondary-text-color;
display: flex;
flex-direction: column;
align-items: center;
&__icon {
font-size: 52px;
height: 52px;
width: 52px;
}
p {
line-height: 0;
}
&__title {
font-size: 18px;
font-weight: 600;
}
&__subtitle,
&__text {
font-size: 14px;
font-weight: 300;
}
}

View File

@ -0,0 +1,33 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatIconModule } from '@angular/material';
import { TranslateModule } from '@ngx-translate/core';
import { EmptyFolderComponent } from './empty-folder.component';
describe('EmptyFolderComponent', () => {
let component: EmptyFolderComponent;
let fixture: ComponentFixture<EmptyFolderComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MatIconModule,
TranslateModule.forRoot()
],
declarations: [
EmptyFolderComponent
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EmptyFolderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,22 @@
import { Component, Input, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'app-empty-folder',
templateUrl: './empty-folder.component.html',
styleUrls: ['./empty-folder.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
// tslint:disable-next-line:use-host-property-decorator
host: { class: 'app-empty-folder' }
})
export class EmptyFolderComponent {
@Input()
icon = 'cake';
@Input()
title = '';
@Input()
subtitle = '';
}

View File

@ -88,11 +88,11 @@
<empty-folder-content> <empty-folder-content>
<ng-template> <ng-template>
<div class="empty-list__block"> <app-empty-folder
<mat-icon>star_rate</mat-icon> icon="star_rate"
<p class="empty-list__title">{{ 'APP.BROWSE.FAVORITES.EMPTY_STATE.TITLE' | translate }}</p> title="APP.BROWSE.FAVORITES.EMPTY_STATE.TITLE"
<p class="empty-list__text">{{ 'APP.BROWSE.FAVORITES.EMPTY_STATE.TEXT' | translate }}</p> subtitle="APP.BROWSE.FAVORITES.EMPTY_STATE.TEXT">
</div> </app-empty-folder>
</ng-template> </ng-template>
</empty-folder-content> </empty-folder-content>

View File

@ -21,11 +21,11 @@
<empty-folder-content> <empty-folder-content>
<ng-template> <ng-template>
<div class="empty-list__block"> <app-empty-folder
<mat-icon>group_work</mat-icon> icon="group_work"
<p class="empty-list__title">{{ 'APP.BROWSE.LIBRARIES.EMPTY_STATE.TITLE' | translate }}</p> title="APP.BROWSE.LIBRARIES.EMPTY_STATE.TITLE"
<p class="empty-list__text">{{ 'APP.BROWSE.LIBRARIES.EMPTY_STATE.TEXT' | translate }}</p> subtitle="APP.BROWSE.LIBRARIES.EMPTY_STATE.TEXT">
</div> </app-empty-folder>
</ng-template> </ng-template>
</empty-folder-content> </empty-folder-content>

View File

@ -84,11 +84,11 @@
<empty-folder-content> <empty-folder-content>
<ng-template> <ng-template>
<div class="empty-list__block"> <app-empty-folder
<mat-icon>access_time</mat-icon> icon="access_time"
<p class="empty-list__title">{{ 'APP.BROWSE.RECENT.EMPTY_STATE.TITLE' | translate }}</p> title="APP.BROWSE.RECENT.EMPTY_STATE.TITLE"
<p class="empty-list__text">{{ 'APP.BROWSE.RECENT.EMPTY_STATE.TEXT' | translate }}</p> subtitle="APP.BROWSE.RECENT.EMPTY_STATE.TEXT">
</div> </app-empty-folder>
</ng-template> </ng-template>
</empty-folder-content> </empty-folder-content>

View File

@ -89,11 +89,11 @@
<empty-folder-content> <empty-folder-content>
<ng-template> <ng-template>
<div class="empty-list__block"> <app-empty-folder
<mat-icon>people</mat-icon> icon="people"
<p class="empty-list__title">{{ 'APP.BROWSE.SHARED.EMPTY_STATE.TITLE' | translate }}</p> title="APP.BROWSE.SHARED.EMPTY_STATE.TITLE"
<p class="empty-list__text">{{ 'APP.BROWSE.SHARED.EMPTY_STATE.TEXT' | translate }}</p> subtitle="APP.BROWSE.SHARED.EMPTY_STATE.TEXT">
</div> </app-empty-folder>
</ng-template> </ng-template>
</empty-folder-content> </empty-folder-content>

View File

@ -38,12 +38,12 @@
<empty-folder-content> <empty-folder-content>
<ng-template> <ng-template>
<div class="empty-list__block"> <app-empty-folder
<mat-icon>delete</mat-icon> icon="delete"
<p class="empty-list__title">{{ 'APP.BROWSE.TRASHCAN.EMPTY_STATE.TITLE' | translate }}</p> title="APP.BROWSE.RECENT.EMPTY_STATE.TITLE">
<p class="empty-list__text">{{ 'APP.BROWSE.TRASHCAN.EMPTY_STATE.FIRST_TEXT' | translate }}</p> <p class="app-empty-folder__text">{{ 'APP.BROWSE.TRASHCAN.EMPTY_STATE.FIRST_TEXT' | translate }}</p>
<p class="empty-list__text">{{ 'APP.BROWSE.TRASHCAN.EMPTY_STATE.SECOND_TEXT' | translate }}</p> <p class="app-empty-folder__text">{{ 'APP.BROWSE.TRASHCAN.EMPTY_STATE.SECOND_TEXT' | translate }}</p>
</div> </app-empty-folder>
</ng-template> </ng-template>
</empty-folder-content> </empty-folder-content>

View File

@ -98,31 +98,4 @@ adf-document-list {
cursor: default; cursor: default;
} }
} }
&__block {
color: $alfresco-secondary-text-color;
display: flex;
flex-direction: column;
align-items: center;
p {
line-height: 0;
}
}
&__title {
font-size: 18px;
font-weight: 600;
}
&__subtitle {
font-size: 14px;
font-weight: 300;
}
&__block > mat-icon {
font-size: 52px;
height: 52px;
width: 52px;
}
} }