[ADF-993] toolbar improvements (#2090)

* toolbar improvements

- simple "title" property to render toolbar title
- advanced "adf-toolbar-title" element for compound toolbars

* move to SASS and improve styling

* fix divider color
This commit is contained in:
Denys Vuika
2017-07-16 22:15:11 +01:00
committed by Eugenio Romano
parent be3d3d2aa3
commit 4c7baca95c
8 changed files with 113 additions and 17 deletions

View File

@@ -0,0 +1,25 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component } from '@angular/core';
@Component({
selector: 'adf-toolbar-title',
template: '<ng-content></ng-content>',
host: { 'class': 'adf-toolbar-title' }
})
export class ToolbarTitleComponent {}

View File

@@ -1,3 +0,0 @@
.adf-toolbar--spacer {
flex: 1 1 auto;
}

View File

@@ -1,5 +1,6 @@
<md-toolbar [color]="color">
<span>{{ title }}</span>
<span *ngIf="title">{{ title }}</span>
<ng-content select="adf-toolbar-title"></ng-content>
<span class="adf-toolbar--spacer"></span>
<ng-content></ng-content>
</md-toolbar>

View File

@@ -0,0 +1,30 @@
@import 'theming';
$adf-toolbar-height: 48px;
$adf-toolbar-font-size: 14px;
.adf-toolbar--spacer {
flex: 1 1 auto;
}
.adf-toolbar {
.mat-toolbar {
min-height: $adf-toolbar-height;
border: 1px solid $alfresco-divider-color;
}
.mat-toolbar-row {
height: $adf-toolbar-height;
font-size: $adf-toolbar-font-size;
& > button {
color: $alfresco-secondary-text-color;
@include material-animation-default(0.28s);
&:hover {
color: $alfresco-primary-text-color;
}
}
}
}

View File

@@ -20,9 +20,10 @@ import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@a
@Component({
selector: 'adf-toolbar',
templateUrl: './toolbar.component.html',
styleUrls: ['./toolbar.component.css'],
styleUrls: ['./toolbar.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
host: { 'class': 'adf-toolbar' }
})
export class ToolbarComponent {

View File

@@ -0,0 +1,40 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MdToolbarModule } from '@angular/material';
import { ToolbarTitleComponent } from './toolbar-title.component';
import { ToolbarComponent } from './toolbar.component';
@NgModule({
imports: [
CommonModule,
MdToolbarModule
],
declarations: [
ToolbarComponent,
ToolbarTitleComponent
],
exports: [
MdToolbarModule,
ToolbarComponent,
ToolbarTitleComponent
]
})
export class ToolbarModule {}