Skip to content

Commit

Permalink
fix(app): statusbarPadding
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jul 30, 2018
1 parent fc0d4c0 commit fd8f875
Show file tree
Hide file tree
Showing 18 changed files with 87 additions and 216 deletions.
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"ionicons": "4.2.6"
},
"devDependencies": {
"@stencil/core": "0.10.10",
"@stencil/core": "0.11.0-0",
"@stencil/dev-server": "latest",
"@stencil/sass": "latest",
"@stencil/utils": "latest",
Expand Down
8 changes: 0 additions & 8 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8122,10 +8122,6 @@ declare global {
* The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
*/
'mode': Mode;
/**
* If true, the toolbar will be translucent. Note: In order to scroll content behind the toolbar, the `fullscreen` attribute needs to be set on the content. Defaults to `false`.
*/
'translucent': boolean;
}
}

Expand Down Expand Up @@ -8156,10 +8152,6 @@ declare global {
* The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
*/
'mode'?: Mode;
/**
* If true, the toolbar will be translucent. Note: In order to scroll content behind the toolbar, the `fullscreen` attribute needs to be set on the content. Defaults to `false`.
*/
'translucent'?: boolean;
}
}
}
Expand Down
20 changes: 2 additions & 18 deletions core/src/components/app/app.ios.scss
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
@import "./app";
@import "./app.ios.vars";

// iOS App
// --------------------------------------------------

.app-ios {
@include footer-safe-area($toolbar-ios-height, $toolbar-ios-padding, $tabbar-ios-height);

// TODO this can be simplified
&.statusbar-padding {
.ion-page,
> ion-header,
.ion-page > ion-header,
ion-menu > .menu-inner,
ion-menu > .menu-inner > ion-header {
@include toolbar-statusbar-padding($toolbar-ios-height, $toolbar-ios-padding, $content-padding, $app-ios-statusbar-padding);
@include toolbar-title-statusbar-padding($toolbar-ios-height, $toolbar-ios-padding, $content-padding, $app-ios-statusbar-padding);
}
}
.app-ios.statusbar-padding {
--ion-statusbar-padding: 20px;
}
11 changes: 0 additions & 11 deletions core/src/components/app/app.ios.vars.scss

This file was deleted.

22 changes: 2 additions & 20 deletions core/src/components/app/app.md.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
@import "./app";
@import "./app.md.vars";

// Material Design App
// --------------------------------------------------

.app-md {
@include footer-safe-area(
$toolbar-md-height,
$toolbar-md-padding,
$tabbar-md-height);

// TODO this can be simplified
&.statusbar-padding {
.ion-page,
.ion-page > ion-header,
ion-tab ion-nav .ion-page > ion-header,
ion-menu > .menu-inner,
ion-menu > .menu-inner > ion-header {
@include toolbar-statusbar-padding($toolbar-md-height, $toolbar-md-padding, $content-md-padding, $app-md-statusbar-padding);
}
}
.app-md.statusbar-padding {
--ion-statusbar-padding: 20px;
}

9 changes: 0 additions & 9 deletions core/src/components/app/app.md.vars.scss

This file was deleted.

3 changes: 2 additions & 1 deletion core/src/components/app/app.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "./app.vars";
@import "../../themes/ionic.globals";
@import "../../themes/ionic.mixins";

// Page Container Structure
// --------------------------------------------------
Expand Down
16 changes: 12 additions & 4 deletions core/src/components/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { Component, Element, Prop, QueueApi } from '@stencil/core';

import { Config } from '../../interface';
import { Config, Mode } from '../../interface';
import { isDevice, isHybrid, needInputShims } from '../../utils/platform';
import { createThemedClasses } from '../../utils/theme';

@Component({
tag: 'ion-app',
styleUrl: 'app.scss'
styleUrls: {
ios: 'app.ios.scss',
md: 'app.md.scss'
}
})
export class App {

mode!: Mode;

@Element() el!: HTMLElement;

@Prop({ context: 'window' }) win!: Window;
Expand All @@ -23,13 +29,15 @@ export class App {
hostData() {
const device = this.config.getBoolean('isDevice', isDevice(this.win));
const hybrid = isHybrid(this.win);
const statusBar = this.config.getBoolean('statusbarPadding', hybrid);
const statusbarPadding = this.config.get('statusbarPadding', hybrid);

return {
class: {
...createThemedClasses(this.mode, 'app'),

'is-device': device,
'is-hydrid': hybrid,
'statusbar-padding': statusBar
'statusbar-padding': statusbarPadding
}
};
}
Expand Down
32 changes: 0 additions & 32 deletions core/src/components/app/app.vars.scss

This file was deleted.

7 changes: 7 additions & 0 deletions core/src/components/footer/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ ion-footer {

z-index: $z-index-toolbar;
}

@supports (padding-top: env(safe-area-inset-top)) {
ion-footer ion-toolbar:last-child {
/* stylelint-disable-next-line property-blacklist */
padding-bottom: env(safe-area-inset-bottom);
}
}
12 changes: 12 additions & 0 deletions core/src/components/header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ ion-header {

z-index: $z-index-toolbar;
}

ion-header ion-toolbar:first-child {
/* stylelint-disable-next-line property-blacklist */
padding-top: var(--ion-statusbar-padding);
}

@supports (padding-top: env(safe-area-inset-top)) {
ion-header ion-toolbar:first-child {
/* stylelint-disable-next-line property-blacklist */
padding-top: calc(env(safe-area-inset-top) + var(--ion-statusbar-padding));
}
}
2 changes: 1 addition & 1 deletion core/src/components/scroll/scroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class Scroll {
this.queue.read(ts => {
this.queued = false;
this.detail.event = ev;
updateScrollDetail(this.detail, this.el, ts!, didStart);
updateScrollDetail(this.detail, this.el, ts, didStart);
this.ionScroll.emit(this.detail);
});
}
Expand Down
7 changes: 7 additions & 0 deletions core/src/components/tabbar/tabbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
order: -1;
}

@supports (padding-top: env(safe-area-inset-top)) {
:host(.placement-bottom) {
padding-bottom: env(safe-area-inset-bottom);
}
}



// Tab Highlight
// --------------------------------------------------
Expand Down
9 changes: 5 additions & 4 deletions core/src/components/toolbar/toolbar.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
--ion-color-contrast: #{$toolbar-ios-text-color};
--border-color: #{$toolbar-ios-border-color};
--translucent-filter: #{$toolbar-ios-translucent-filter};

@include padding($toolbar-ios-padding);

min-height: $toolbar-ios-height;
--padding-top: #{$toolbar-ios-padding};
--padding-bottom: #{$toolbar-ios-padding};
--padding-start: #{$toolbar-ios-padding};
--padding-end: #{$toolbar-ios-padding};
--min-height: #{$toolbar-ios-height};

font-family: $toolbar-ios-font-family;
}
Expand Down
9 changes: 5 additions & 4 deletions core/src/components/toolbar/toolbar.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
--ion-color-base: #{$toolbar-md-background-color};
--ion-color-contrast: #{$toolbar-md-text-color};
--border-color: #{$toolbar-md-border-color};

@include padding($toolbar-md-padding);

min-height: #{$toolbar-md-height};
--padding-top: #{$toolbar-md-padding};
--padding-bottom: #{$toolbar-md-padding};
--padding-start: #{$toolbar-md-padding};
--padding-end: #{$toolbar-md-padding};
--min-height: #{$toolbar-md-height};

font-family: #{$toolbar-md-font-family};
}
Expand Down
29 changes: 21 additions & 8 deletions core/src/components/toolbar/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@

@include font-smoothing();

display: block;

width: 100%;

color: #{current-color(contrast)};

contain: content;

z-index: $z-index-toolbar;
box-sizing: border-box;
}

.toolbar-container {
@include padding(
var(--padding-top),
var(--padding-end),
var(--padding-bottom),
var(--padding-start)
);

display: flex;
position: relative;

Expand All @@ -20,23 +40,16 @@

width: 100%;

color: #{current-color(contrast)};
min-height: var(--min-height);

contain: content;
overflow: hidden;
z-index: $z-index-toolbar;
box-sizing: border-box;
backdrop-filter: var(--backdrop-filter);
}

// Transparent Toolbar
// --------------------------------------------------

:host(.toolbar-translucent) {
--backdrop-filter: var(--translucent-filter);
--opacity: .8;
}

.toolbar-background {
@include position(0, 0, 0, 0);

Expand Down
29 changes: 10 additions & 19 deletions core/src/components/toolbar/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,24 @@ export class Toolbar {
*/
@Prop() mode!: Mode;

/**
* If true, the toolbar will be translucent.
* Note: In order to scroll content behind the toolbar, the `fullscreen`
* attribute needs to be set on the content.
* Defaults to `false`.
*/
@Prop() translucent = false;

hostData() {
return {
class: {
...createColorClasses(this.color),
'toolbar-translucent': this.translucent
}
class: createColorClasses(this.color)
};
}

render() {
return [
<div class="toolbar-background"></div>,
<slot name="start"></slot>,
<slot name="secondary"></slot>,
<div class="toolbar-content">
<slot></slot>
</div>,
<slot name="primary"></slot>,
<slot name="end"></slot>
<div class="toolbar-container">
<slot name="start"></slot>
<slot name="secondary"></slot>
<div class="toolbar-content">
<slot></slot>
</div>
<slot name="primary"></slot>
<slot name="end"></slot>
</div>
];
}
}
Loading

0 comments on commit fd8f875

Please sign in to comment.