Skip to content

Commit 3739b1b

Browse files
committed
add translucent on ionic header
1 parent 911684f commit 3739b1b

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

core/src/components.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ export namespace Components {
14601460
*/
14611461
"theme"?: "ios" | "md" | "ionic";
14621462
/**
1463-
* If `true`, the header will be translucent. Only applies when the theme 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.
1463+
* If `true`, the header will be translucent. Only applies when the theme is `"ios"` or `"ionic"` 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.
14641464
* @default false
14651465
*/
14661466
"translucent": boolean;
@@ -7369,7 +7369,7 @@ declare namespace LocalJSX {
73697369
*/
73707370
"theme"?: "ios" | "md" | "ionic";
73717371
/**
7372-
* If `true`, the header will be translucent. Only applies when the theme 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.
7372+
* If `true`, the header will be translucent. Only applies when the theme is `"ios"` or `"ionic"` 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.
73737373
* @default false
73747374
*/
73757375
"translucent"?: boolean;

core/src/components/header/header.ionic.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ ion-toolbar + ion-toolbar {
1717
--padding-start: #{globals.$ion-space-400};
1818
--padding-end: #{globals.$ion-space-400};
1919
}
20+
21+
@supports (backdrop-filter: blur(0)) {
22+
.header-background {
23+
@include globals.position(0, 0, 0, 0);
24+
25+
position: absolute;
26+
27+
backdrop-filter: saturate(180%) blur(globals.$ion-scale-100);
28+
}
29+
.header-translucent-ionic ion-toolbar {
30+
--opacity: 0.7;
31+
}
32+
}

core/src/components/header/header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class Header implements ComponentInterface {
5555

5656
/**
5757
* If `true`, the header will be translucent.
58-
* Only applies when the theme is `"ios"` and the device supports
58+
* Only applies when the theme is `"ios"` or `"ionic"` and the device supports
5959
* [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).
6060
*
6161
* Note: In order to scroll content behind the header, the `fullscreen`
@@ -239,7 +239,7 @@ export class Header implements ComponentInterface {
239239
}}
240240
{...inheritedAttributes}
241241
>
242-
{theme === 'ios' && translucent && <div class="header-background"></div>}
242+
{theme !== 'md' && translucent && <div class="header-background"></div>}
243243
<slot></slot>
244244
</Host>
245245
);

0 commit comments

Comments
 (0)