mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Added new common header partial, to be used by ionic theme and ios/md - Renamed header.scss to header.native.scss. This inherits the common created above and its used only on ios and md partial - Created new partial for ionic theme. - Added ionic theme to basic e2e tests. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> [Sample Header Screen](https://ionic-framework-rcfex2fep-ionic1.vercel.app/src/components/header/test/basic?ionic:theme=ionic) --------- Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com> Co-authored-by: ionitron <hi@ionicframework.com> Co-authored-by: Maria Hutt <maria@ionic.io>
144 lines
4.0 KiB
SCSS
144 lines
4.0 KiB
SCSS
@import "./header.native";
|
|
@import "./header.ios.vars";
|
|
|
|
// iOS Header
|
|
// --------------------------------------------------
|
|
|
|
.header-ios ion-toolbar:last-of-type {
|
|
--border-width: 0 0 #{$hairlines-width};
|
|
}
|
|
|
|
@supports (backdrop-filter: blur(0)) {
|
|
.header-background {
|
|
@include position(0, 0, 0, 0);
|
|
|
|
position: absolute;
|
|
|
|
backdrop-filter: $header-ios-translucent-filter;
|
|
}
|
|
.header-translucent-ios ion-toolbar {
|
|
--opacity: 0.8;
|
|
}
|
|
|
|
/**
|
|
* Disable the saturation otherwise it distorts the content
|
|
* background color when large header is not collapsed
|
|
*/
|
|
.header-collapse-condense-inactive .header-background {
|
|
backdrop-filter: blur($header-ios-blur);
|
|
}
|
|
}
|
|
|
|
.header-ios.ion-no-border ion-toolbar:last-of-type {
|
|
--border-width: 0;
|
|
}
|
|
|
|
// iOS Header - Collapse Fade
|
|
// --------------------------------------------------
|
|
.header-collapse-fade ion-toolbar {
|
|
--opacity-scale: inherit;
|
|
}
|
|
|
|
// iOS Header - Collapse Condense
|
|
// --------------------------------------------------
|
|
.header-collapse-condense {
|
|
z-index: 9;
|
|
}
|
|
|
|
.header-collapse-condense ion-toolbar {
|
|
position: sticky;
|
|
top: 0;
|
|
}
|
|
|
|
.header-collapse-condense ion-toolbar:first-of-type {
|
|
/**
|
|
* The toolbar that contains the collapsible
|
|
* large title should not have safe area padding applied.
|
|
*/
|
|
padding-top: 0px;
|
|
|
|
z-index: 1;
|
|
}
|
|
|
|
/**
|
|
* Large title toolbar should just use the content background
|
|
* since it needs to blend in with the header above it.
|
|
*/
|
|
.header-collapse-condense ion-toolbar {
|
|
--background: var(--ion-background-color, #fff);
|
|
|
|
z-index: 0;
|
|
}
|
|
|
|
.header-collapse-condense ion-toolbar:last-of-type {
|
|
--border-width: 0px;
|
|
}
|
|
|
|
.header-collapse-condense ion-toolbar ion-searchbar {
|
|
padding-top: 0px;
|
|
padding-bottom: 13px;
|
|
}
|
|
|
|
.header-collapse-main {
|
|
--opacity-scale: 1;
|
|
}
|
|
|
|
.header-collapse-main ion-toolbar {
|
|
--opacity-scale: inherit;
|
|
}
|
|
|
|
.header-collapse-main ion-toolbar.in-toolbar ion-title,
|
|
.header-collapse-main ion-toolbar.in-toolbar ion-buttons {
|
|
transition: all 0.2s ease-in-out;
|
|
}
|
|
|
|
.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,
|
|
.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse {
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
}
|
|
|
|
/**
|
|
* There is a bug in Safari where changing
|
|
* the opacity of an element in a scrollable container
|
|
* while rubber-banding causes the scroll position
|
|
* to jump to the top
|
|
*/
|
|
.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,
|
|
.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse {
|
|
visibility: hidden;
|
|
}
|
|
|
|
/**
|
|
* The main header is only hidden once the collapsible large
|
|
* title is configured. As a result, if the main header loads
|
|
* before the collapsible large title is configured then the
|
|
* main header will be visible briefly before being hidden
|
|
* by the collapsible large title.
|
|
*
|
|
* The following selector ensures that any main header
|
|
* on a page with a collapsible large title is hidden
|
|
* before the collapsible large title is configured.
|
|
* Once the collapsible large title is configured the main
|
|
* header will have the ".header-collapse-main" class, and
|
|
* this selector will no longer apply.
|
|
*
|
|
* The :has(...) part of the selector ensures a couple things:
|
|
* 1. This will only apply within a page view since the content
|
|
* must be a subsequent-sibling of the header (~ ion-content).
|
|
* 2. This will only apply when that content has a collapse header (ion-header[collapse="condense"])
|
|
*
|
|
* We use opacity: 0 to avoid a layout shift.
|
|
* We target both the attribute and the class in the event that the attribute
|
|
* is not reflected on the host in some frameworks.
|
|
*
|
|
* Both headers should be scoped to iOS mode otherwise an MD app that uses an
|
|
* iOS header may cause other MD headers to be unexpectedly hidden.
|
|
*/
|
|
ion-header.header-ios:not(.header-collapse-main):has(
|
|
~ ion-content ion-header.header-ios[collapse="condense"],
|
|
~ ion-content ion-header.header-ios.header-collapse-condense
|
|
) {
|
|
opacity: 0;
|
|
}
|