mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { Component, ComponentInterface, Prop } from '@stencil/core';
|
|
|
|
import { getIonMode } from '../../global/ionic-global';
|
|
|
|
/**
|
|
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
|
|
*/
|
|
@Component({
|
|
tag: 'ion-header',
|
|
styleUrls: {
|
|
ios: 'header.ios.scss',
|
|
md: 'header.md.scss'
|
|
}
|
|
})
|
|
export class Header implements ComponentInterface {
|
|
|
|
/**
|
|
* If `true`, the header will be translucent.
|
|
* Only applies when the mode is `"ios"` and the device supports
|
|
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
|
|
*
|
|
* Note: In order to scroll content behind the header, the `fullscreen`
|
|
* attribute needs to be set on the content.
|
|
*/
|
|
@Prop() translucent = false;
|
|
|
|
hostData() {
|
|
const mode = getIonMode(this);
|
|
return {
|
|
role: 'banner',
|
|
class: {
|
|
[mode]: true,
|
|
|
|
// Used internally for styling
|
|
[`header-${mode}`]: true,
|
|
|
|
[`header-translucent`]: this.translucent,
|
|
[`header-translucent-${mode}`]: this.translucent,
|
|
}
|
|
};
|
|
}
|
|
}
|