Fixed: Toolbar background color issues

This commit is contained in:
Sercan Yemen 2018-06-09 14:26:00 +03:00
parent 5ed04c3925
commit bd79830cb4
6 changed files with 9 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<div class="fuse-search-bar" [ngClass]="{'expanded':!collapsed}"> <div class="fuse-search-bar" [ngClass]="{'expanded':!collapsed}">
<div class="fuse-search-bar-content" [ngClass]="toolbarColor"> <div class="fuse-search-bar-content" [ngClass]="fuseConfig.layout.toolbar.background">
<label for="fuse-search-bar-input"> <label for="fuse-search-bar-input">
<button mat-icon-button class="fuse-search-bar-expander" aria-label="Expand Search Bar" (click)="expand()" <button mat-icon-button class="fuse-search-bar-expander" aria-label="Expand Search Bar" (click)="expand()"

View File

@ -13,10 +13,9 @@ export class FuseSearchBarComponent implements OnInit, OnDestroy
{ {
collapsed: boolean; collapsed: boolean;
fuseConfig: any; fuseConfig: any;
toolbarColor: string;
@Output() @Output()
onInput: EventEmitter<any>; input: EventEmitter<any>;
// Private // Private
private _unsubscribeAll: Subject<any>; private _unsubscribeAll: Subject<any>;
@ -31,7 +30,7 @@ export class FuseSearchBarComponent implements OnInit, OnDestroy
) )
{ {
// Set the defaults // Set the defaults
this.onInput = new EventEmitter(); this.input = new EventEmitter();
this.collapsed = true; this.collapsed = true;
// Set the private defaults // Set the private defaults
@ -52,7 +51,7 @@ export class FuseSearchBarComponent implements OnInit, OnDestroy
.pipe(takeUntil(this._unsubscribeAll)) .pipe(takeUntil(this._unsubscribeAll))
.subscribe( .subscribe(
(config) => { (config) => {
this.toolbarColor = config.layout.toolbar.background; this.fuseConfig = config;
} }
); );
} }
@ -94,9 +93,7 @@ export class FuseSearchBarComponent implements OnInit, OnDestroy
*/ */
search(event): void search(event): void
{ {
const value = event.target.value; this.input.emit(event.target.value);
this.onInput.emit(value);
} }
} }

View File

@ -7,7 +7,7 @@
</button> </button>
</div> </div>
<div class="shortcuts" fxHide fxShow.gt-sm [ngClass]="toolbarColor"> <div class="shortcuts" fxHide fxShow.gt-sm>
<div fxLayout="row" fxLayoutAlign="space-between center" fxFlex="0 1 auto"> <div fxLayout="row" fxLayoutAlign="space-between center" fxFlex="0 1 auto">

View File

@ -6,7 +6,6 @@ import { takeUntil } from 'rxjs/operators';
import { FuseMatchMediaService } from '@fuse/services/match-media.service'; import { FuseMatchMediaService } from '@fuse/services/match-media.service';
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service'; import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
import { FuseConfigService } from '@fuse/services/config.service';
@Component({ @Component({
selector : 'fuse-shortcuts', selector : 'fuse-shortcuts',
@ -20,7 +19,6 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy
filteredNavigationItems: any[]; filteredNavigationItems: any[];
searching: boolean; searching: boolean;
mobileShortcutsPanelActive: boolean; mobileShortcutsPanelActive: boolean;
toolbarColor: string;
@Input() @Input()
navigation: any; navigation: any;
@ -41,12 +39,10 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy
* @param {CookieService} _cookieService * @param {CookieService} _cookieService
* @param {FuseMatchMediaService} _fuseMatchMediaService * @param {FuseMatchMediaService} _fuseMatchMediaService
* @param {FuseNavigationService} _fuseNavigationService * @param {FuseNavigationService} _fuseNavigationService
* @param {FuseConfigService} _fuseConfigService
* @param {ObservableMedia} _observableMedia * @param {ObservableMedia} _observableMedia
*/ */
constructor( constructor(
private _cookieService: CookieService, private _cookieService: CookieService,
private _fuseConfigService: FuseConfigService,
private _fuseMatchMediaService: FuseMatchMediaService, private _fuseMatchMediaService: FuseMatchMediaService,
private _fuseNavigationService: FuseNavigationService, private _fuseNavigationService: FuseNavigationService,
private _observableMedia: ObservableMedia, private _observableMedia: ObservableMedia,
@ -71,15 +67,6 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy
*/ */
ngOnInit(): void ngOnInit(): void
{ {
// Subscribe to config changes
this._fuseConfigService.config
.pipe(takeUntil(this._unsubscribeAll))
.subscribe(
(config) => {
this.toolbarColor = config.layout.toolbar.background;
}
);
// Get the navigation items and flatten them // Get the navigation items and flatten them
this.filteredNavigationItems = this.navigationItems = this._fuseNavigationService.getFlatNavigation(this.navigation); this.filteredNavigationItems = this.navigationItems = this._fuseNavigationService.getFlatNavigation(this.navigation);

View File

@ -58,7 +58,7 @@
<div class="toolbar-separator"></div> <div class="toolbar-separator"></div>
<fuse-search-bar (onInput)="search($event)"></fuse-search-bar> <fuse-search-bar (input)="search($event)"></fuse-search-bar>
<div class="toolbar-separator"></div> <div class="toolbar-separator"></div>

View File

@ -26,7 +26,7 @@
<p class="py-8"> <p class="py-8">
<fuse-highlight lang="html"> <fuse-highlight lang="html">
<textarea #source> <textarea #source>
<fuse-search-bar (onInput)="search($event)"></fuse-search-bar> <fuse-search-bar (input)="search($event)"></fuse-search-bar>
</textarea> </textarea>
</fuse-highlight> </fuse-highlight>
</p> </p>
@ -35,7 +35,7 @@
<div class="my-48"> <div class="my-48">
<h2>Outputs</h2> <h2>Outputs</h2>
<p class="py-8" fxLayout="row" fxLayoutAlign="start center"> <p class="py-8" fxLayout="row" fxLayoutAlign="start center">
<code class="mr-8">onInput</code> <code class="mr-8">input</code>
<span>Triggers every time an input occurs within the search bar. Can be used to trigger the actual <span>Triggers every time an input occurs within the search bar. Can be used to trigger the actual
search mechanism. The $event is the value from the search input. search mechanism. The $event is the value from the search input.
</span> </span>