mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 23:58:13 +08:00
feat(ionic-theme): improve scss architecture for ionic theme (#29345)
Issue number: None --------- <!-- 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. --> This PR follows the architectural changes defined on the _SCSS Architecture Design Doc_. Due to some of the developments done in the meantime, not everything that was defined on that document was followed and some sections were simplified. Overall, there were two guidelines that supported the work on this PR: - Have no impact on the current scss partials & CSS architecture for the `md/iOS` themes. - Make everything related to the new `Ionic` Theme separated. Based on these, here're the changes made: **On Themes folder (private):** - Renamed current internal scss partials on src/themes, related to md/iOS, to `native.*.scss` and move them to a new folder, called `native`. Updated imports on all framework. - Removed the ionic prefix from the name of the mixins and function partials on src/themes. Updated imports on all framework. - Created new folder, named ionic, inside src/themes. This holds the `ionic.globals.scss`, with all the mixins and functions forwarded, to be used on other scopes. - Replaced on already created Ionic theme files, the usage of tokens and mixins with @use, to instead _@use "../../themes/ionic/ionic.globals.scss" as globals;_. This ensures an equal approach is followed everywhere and also makes it easier to change the files imported or paths, in the future, as its all in the same global file. - Updated the foundations `readMe` file, with the new process for using globals.  **On css folder (public):** - Created new folder, named `ionic`, inside src/css. This holds all the files related exclusively to Ionic Theme, following the same structure as exists now for md/iOS, with a core, a bundle, utils, etc. Some files were a bit duplicated, to eliminate imports from ios or md theme partials. The only file common to both Themes is the `normalize.scss`. - No folder structure or renamings were done on the existing output, to prevent breaking-changes for developers already making imports from this folder. - Updated typography and link partials to use globals instead of tokens. - Changed `font-size` styles on typography to be on `body`, instead of `html`, to enable correct support of accessibility features on browsers and devices, related to `font-size`.  **Other changes related to global styles new architecture:** - Updated margin & padding utility-classed generated by token, to include css variables and padding/margin mixins. - Updated link test to use new global Ionic bundle, correct utility-class on ion-content and updated snapshots. The font-size changed to 16, as its now the default on the body. - Updated typography snapshots. - Updated prettier format on all scss files. Later on we should make sure this is equal for all team members. ## 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. --> --------- Co-authored-by: Sean Perkins <sean@ionic.io>
This commit is contained in:
@ -31,7 +31,6 @@
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb: Focused
|
||||
// ------------------------------------------
|
||||
|
||||
@ -41,7 +40,7 @@
|
||||
|
||||
:host(.in-breadcrumbs-color.ion-focused) .breadcrumb-native,
|
||||
:host(.ion-color.ion-focused) .breadcrumb-native {
|
||||
background: #{current-color(base, .1)};
|
||||
background: #{current-color(base, 0.1)};
|
||||
color: #{current-color(base)};
|
||||
}
|
||||
|
||||
@ -51,7 +50,6 @@
|
||||
color: $breadcrumb-ios-icon-color-focused;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb Separator
|
||||
// ------------------------------------------
|
||||
|
||||
@ -59,7 +57,6 @@
|
||||
color: $breadcrumb-ios-separator-color;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb Slotted Icons
|
||||
// ------------------------------------------
|
||||
|
||||
@ -81,7 +78,6 @@
|
||||
color: $breadcrumb-ios-icon-color-active;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumbs Collapsed Indicator
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
@ -1,34 +1,40 @@
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
@import "../../themes/native/native.globals.ios";
|
||||
|
||||
// iOS Breadcrumb
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Color of the breadcrumb
|
||||
$breadcrumb-ios-color: var(--ion-color-step-850, var(--ion-text-color-step-150, #2d4665)) !default;
|
||||
$breadcrumb-ios-color: var(--ion-color-step-850, var(--ion-text-color-step-150, #2d4665)) !default;
|
||||
|
||||
/// @prop - Color of the active breadcrumb
|
||||
$breadcrumb-ios-color-active: var(--ion-text-color, #03060b) !default;
|
||||
$breadcrumb-ios-color-active: var(--ion-text-color, #03060b) !default;
|
||||
|
||||
/// @prop - Background color of the focused breadcrumb
|
||||
$breadcrumb-ios-background-focused: var(--ion-color-step-50, var(--ion-background-color-step-50, rgba(233, 237, 243, 0.7))) !default;
|
||||
$breadcrumb-ios-background-focused: var(
|
||||
--ion-color-step-50,
|
||||
var(--ion-background-color-step-50, rgba(233, 237, 243, 0.7))
|
||||
) !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb icon
|
||||
$breadcrumb-ios-icon-color: var(--ion-color-step-400, var(--ion-text-color-step-600, #92a0b3)) !default;
|
||||
$breadcrumb-ios-icon-color: var(--ion-color-step-400, var(--ion-text-color-step-600, #92a0b3)) !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb icon when active
|
||||
$breadcrumb-ios-icon-color-active: var(--ion-color-step-850, var(--ion-text-color-step-150, #242d39)) !default;
|
||||
$breadcrumb-ios-icon-color-active: var(--ion-color-step-850, var(--ion-text-color-step-150, #242d39)) !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb icon when focused
|
||||
$breadcrumb-ios-icon-color-focused: var(--ion-color-step-750, var(--ion-text-color-step-250, #445b78)) !default;
|
||||
$breadcrumb-ios-icon-color-focused: var(--ion-color-step-750, var(--ion-text-color-step-250, #445b78)) !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb separator
|
||||
$breadcrumb-ios-separator-color: $breadcrumb-separator-color !default;
|
||||
$breadcrumb-ios-separator-color: $breadcrumb-separator-color !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb indicator
|
||||
$breadcrumb-ios-indicator-color: $breadcrumb-ios-separator-color !default;
|
||||
$breadcrumb-ios-indicator-color: $breadcrumb-ios-separator-color !default;
|
||||
|
||||
/// @prop - Background color of the breadcrumb indicator
|
||||
$breadcrumb-ios-indicator-background: var(--ion-color-step-100, var(--ion-background-color-step-100, #e9edf3)) !default;
|
||||
$breadcrumb-ios-indicator-background: var(--ion-color-step-100, var(--ion-background-color-step-100, #e9edf3)) !default;
|
||||
|
||||
/// @prop - Background color of the breadcrumb indicator when focused
|
||||
$breadcrumb-ios-indicator-background-focused: var(--ion-color-step-150, var(--ion-background-color-step-150, #d9e0ea)) !default;
|
||||
$breadcrumb-ios-indicator-background-focused: var(
|
||||
--ion-color-step-150,
|
||||
var(--ion-background-color-step-150, #d9e0ea)
|
||||
) !default;
|
||||
|
||||
@ -20,15 +20,18 @@
|
||||
@include padding(6px, 12px, 6px, 12px);
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb Separator
|
||||
// ------------------------------------------
|
||||
|
||||
.breadcrumb-separator {
|
||||
@include margin($breadcrumb-md-separator-margin-top, $breadcrumb-md-separator-margin-end, $breadcrumb-md-separator-margin-bottom, $breadcrumb-md-separator-margin-start);
|
||||
@include margin(
|
||||
$breadcrumb-md-separator-margin-top,
|
||||
$breadcrumb-md-separator-margin-end,
|
||||
$breadcrumb-md-separator-margin-bottom,
|
||||
$breadcrumb-md-separator-margin-start
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb: Focused
|
||||
// ------------------------------------------
|
||||
|
||||
@ -38,7 +41,6 @@
|
||||
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2), 0px 2px 8px rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb Separator
|
||||
// ------------------------------------------
|
||||
|
||||
@ -46,7 +48,6 @@
|
||||
color: $breadcrumb-md-separator-color;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb Slotted Icons
|
||||
// ------------------------------------------
|
||||
|
||||
@ -68,7 +69,6 @@
|
||||
color: $breadcrumb-md-icon-color-active;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumbs Collapsed Indicator
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
@ -1,46 +1,49 @@
|
||||
@import "../../themes/ionic.globals.md";
|
||||
@import "../../themes/native/native.globals.md";
|
||||
|
||||
// Material Design Breadcrumb
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Color of the breadcrumb
|
||||
$breadcrumb-md-color: var(--ion-color-step-600, var(--ion-text-color-step-400, #677483)) !default;
|
||||
$breadcrumb-md-color: var(--ion-color-step-600, var(--ion-text-color-step-400, #677483)) !default;
|
||||
|
||||
/// @prop - Color of the active breadcrumb
|
||||
$breadcrumb-md-color-active: var(--ion-text-color, #03060b) !default;
|
||||
$breadcrumb-md-color-active: var(--ion-text-color, #03060b) !default;
|
||||
|
||||
/// @prop - Color of the focused breadcrumb
|
||||
$breadcrumb-md-color-focused: var(--ion-color-step-800, var(--ion-text-color-step-200, #35404e)) !default;
|
||||
$breadcrumb-md-color-focused: var(--ion-color-step-800, var(--ion-text-color-step-200, #35404e)) !default;
|
||||
|
||||
/// @prop - Background color of the focused breadcrumb
|
||||
$breadcrumb-md-background-focused: var(--ion-color-step-50, var(--ion-background-color-step-50, #fff)) !default;
|
||||
$breadcrumb-md-background-focused: var(--ion-color-step-50, var(--ion-background-color-step-50, #fff)) !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb icon
|
||||
$breadcrumb-md-icon-color: var(--ion-color-step-550, var(--ion-text-color-step-450, #7d8894)) !default;
|
||||
$breadcrumb-md-icon-color: var(--ion-color-step-550, var(--ion-text-color-step-450, #7d8894)) !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb icon when active
|
||||
$breadcrumb-md-icon-color-active: var(--ion-color-step-850, var(--ion-text-color-step-150, #222d3a)) !default;
|
||||
$breadcrumb-md-icon-color-active: var(--ion-color-step-850, var(--ion-text-color-step-150, #222d3a)) !default;
|
||||
|
||||
/// @prop - Margin top of the breadcrumb separator
|
||||
$breadcrumb-md-separator-margin-top: -1px !default;
|
||||
$breadcrumb-md-separator-margin-top: -1px !default;
|
||||
|
||||
/// @prop - Margin end of the breadcrumb separator
|
||||
$breadcrumb-md-separator-margin-end: 10px !default;
|
||||
$breadcrumb-md-separator-margin-end: 10px !default;
|
||||
|
||||
/// @prop - Margin bottom of the breadcrumb separator
|
||||
$breadcrumb-md-separator-margin-bottom: null !default;
|
||||
$breadcrumb-md-separator-margin-bottom: null !default;
|
||||
|
||||
/// @prop - Margin start of the breadcrumb separator
|
||||
$breadcrumb-md-separator-margin-start: 10px !default;
|
||||
$breadcrumb-md-separator-margin-start: 10px !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb separator
|
||||
$breadcrumb-md-separator-color: $breadcrumb-separator-color !default;
|
||||
$breadcrumb-md-separator-color: $breadcrumb-separator-color !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb indicator
|
||||
$breadcrumb-md-indicator-color: $breadcrumb-md-separator-color !default;
|
||||
$breadcrumb-md-indicator-color: $breadcrumb-md-separator-color !default;
|
||||
|
||||
/// @prop - Background color of the breadcrumb indicator
|
||||
$breadcrumb-md-indicator-background: var(--ion-color-step-100, var(--ion-background-color-step-100, #eef1f3)) !default;
|
||||
$breadcrumb-md-indicator-background: var(--ion-color-step-100, var(--ion-background-color-step-100, #eef1f3)) !default;
|
||||
|
||||
/// @prop - Background color of the breadcrumb indicator when focused
|
||||
$breadcrumb-md-indicator-background-focused: var(--ion-color-step-150, var(--ion-background-color-step-150, #dfe5e8)) !default;
|
||||
$breadcrumb-md-indicator-background-focused: var(
|
||||
--ion-color-step-150,
|
||||
var(--ion-background-color-step-150, #dfe5e8)
|
||||
) !default;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
/**
|
||||
/**
|
||||
* @prop --color: Text color of the breadcrumb
|
||||
* @prop --color-active: Text color of the active breadcrumb
|
||||
* @prop --color-hover: Text color of the breadcrumb on hover
|
||||
@ -43,11 +43,10 @@
|
||||
|
||||
:host(.breadcrumb-disabled) {
|
||||
cursor: default;
|
||||
opacity: .5;
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb: Active
|
||||
// ------------------------------------------
|
||||
|
||||
@ -55,7 +54,6 @@
|
||||
color: var(--color-active);
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb: Focused
|
||||
// ------------------------------------------
|
||||
|
||||
@ -67,7 +65,6 @@
|
||||
background: var(--background-focused);
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb: Hover
|
||||
// ------------------------------------------
|
||||
|
||||
@ -82,7 +79,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb Separator
|
||||
// ------------------------------------------
|
||||
|
||||
@ -90,7 +86,6 @@
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumb: Collapsed
|
||||
// ------------------------------------------
|
||||
|
||||
@ -98,7 +93,6 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumbs: Color
|
||||
// ------------------------------------------
|
||||
|
||||
@ -120,14 +114,13 @@
|
||||
|
||||
:host(.in-toolbar-color),
|
||||
:host(.in-toolbar-color) .breadcrumb-separator {
|
||||
color: current-color(contrast, .8);
|
||||
color: current-color(contrast, 0.8);
|
||||
}
|
||||
|
||||
:host(.in-toolbar-color.breadcrumb-active) {
|
||||
color: current-color(contrast);
|
||||
}
|
||||
|
||||
|
||||
// Breadcrumbs: Collapsed Indicator
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "../../themes/native/native.globals";
|
||||
|
||||
// Breadcrumb
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Font weight of the breadcrumb
|
||||
$breadcrumb-font-weight: 400 !default;
|
||||
$breadcrumb-font-weight: 400 !default;
|
||||
|
||||
$breadcrumb-baseline-font-size: 16px !default;
|
||||
|
||||
/// @prop - Font size of the breadcrumb
|
||||
$breadcrumb-font-size: dynamic-font($breadcrumb-baseline-font-size) !default;
|
||||
$breadcrumb-font-size: dynamic-font($breadcrumb-baseline-font-size) !default;
|
||||
|
||||
/// @prop - Color of the breadcrumb separator
|
||||
$breadcrumb-separator-color: var(--ion-color-step-550, var(--ion-text-color-step-450, #73849a)) !default;
|
||||
$breadcrumb-separator-color: var(--ion-color-step-550, var(--ion-text-color-step-450, #73849a)) !default;
|
||||
|
||||
Reference in New Issue
Block a user