Skip to content

Commit

Permalink
feat(statusbarPadding): add statusbar-padding css to toolbars
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Apr 14, 2016
1 parent 5538999 commit 44403d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
5 changes: 4 additions & 1 deletion ionic/components/navbar/navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class ToolbarBackground {
'</div>',
host: {
'[hidden]': '_hidden',
'class': 'toolbar'
'class': 'toolbar',
'[class.statusbar-padding]': '_sbPadding'
},
directives: [BackButton, BackButtonText, Icon, ToolbarBackground]
})
Expand All @@ -120,6 +121,7 @@ export class Navbar extends ToolbarBase {
private _bbRef: ElementRef;
private _bbtRef: ElementRef;
private _bgRef: ElementRef;
private _sbPadding: boolean;

/**
* @input {boolean} whether the back button should be shown or not
Expand All @@ -145,6 +147,7 @@ export class Navbar extends ToolbarBase {

this._bbIcon = config.get('backButtonIcon');
this._bbText = config.get('backButtonText');
this._sbPadding = config.getBoolean('statusbarPadding', false);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion ionic/components/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ import {isBlank, isTrueProperty} from '../../util/util';
@Component({
selector: 'ion-tabs',
template:
'<ion-navbar-section>' +
'<ion-navbar-section [class.statusbar-padding]="_sbPadding">' +
'<template navbar-anchor></template>' +
'</ion-navbar-section>' +
'<ion-tabbar-section>' +
Expand Down Expand Up @@ -167,6 +167,7 @@ export class Tabs extends Ion {
private _preloadTabs: boolean = null;
private _tabs: Array<Tab> = [];
private _onReady = null;
private _sbPadding: boolean;
private _useHighlight: boolean;

/**
Expand Down Expand Up @@ -238,6 +239,7 @@ export class Tabs extends Ion {
this.id = ++tabIds;
this.subPages = _config.getBoolean('tabSubPages');
this._useHighlight = _config.getBoolean('tabbarHighlight');
this._sbPadding = _config.getBoolean('statusbarPadding', false);

if (parent) {
// this Tabs has a parent Nav
Expand Down
10 changes: 7 additions & 3 deletions ionic/components/toolbar/toolbar.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {Component, Directive, Host, ElementRef, Optional, forwardRef, Inject, ContentChildren, ContentChild, QueryList, ChangeDetectionStrategy, ViewEncapsulation} from 'angular2/core';

import {Button} from '../button/button';
import {Config} from '../../config/config';
import {Ion} from '../ion';
import {MenuToggle} from '../menu/menu-toggle';
import {Navbar} from '../navbar/navbar';
import {Button} from '../button/button';


/**
Expand Down Expand Up @@ -108,14 +109,17 @@ export class ToolbarBase extends Ion {
'<ng-content></ng-content>' +
'</div>',
host: {
'class': 'toolbar'
'class': 'toolbar',
'[class.statusbar-padding]': '_sbPadding'
},
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class Toolbar extends ToolbarBase {
private _sbPadding: boolean;

constructor(elementRef: ElementRef) {
constructor(elementRef: ElementRef, config: Config) {
super(elementRef);
this._sbPadding = config.getBoolean('statusbarPadding', false);
}

}
Expand Down
7 changes: 2 additions & 5 deletions ionic/platform/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,11 @@ Platform.register({
keyboardHeight: 300,
mode: 'ios',
scrollAssist: isIOSDevice,
statusbarPadding: !!(win.cordova),
swipeBackEnabled: isIOSDevice,
swipeBackThreshold: 40,
tapPolyfill: isIOSDevice,
virtualScrollEventAssist: function() {
// UIWebView needs help getting scroll events
// WKWebView does not (WKWebView supports indexDB)
return !(window.indexedDB);
}
virtualScrollEventAssist: !(window.indexedDB)
},
isMatch(p: Platform): boolean {
return p.isPlatformMatch('ios', ['iphone', 'ipad', 'ipod'], ['windows phone']);
Expand Down

0 comments on commit 44403d1

Please sign in to comment.