mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
refactor(segment): MD fixing the segment colors in toolbars with colors
references #597
This commit is contained in:
@ -39,34 +39,63 @@ ion-segment {
|
|||||||
|
|
||||||
ion-segment {
|
ion-segment {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
|
ion-segment-button[button][outline].activated {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Default Button Colors
|
// Generate Default Segment Colors
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
@each $color, $value in $colors {
|
@mixin segment-button($button-color) {
|
||||||
|
background-color: transparent;
|
||||||
|
|
||||||
ion-segment[#{$color}] {
|
&[outline] {
|
||||||
|
color: $button-color;
|
||||||
ion-segment-button[button] {
|
|
||||||
$bg-color: $value;
|
|
||||||
$text-color: inverse($bg-color);
|
|
||||||
|
|
||||||
|
&.activated {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: $text-color;
|
color: $button-color;
|
||||||
|
border-color: $button-color;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&[outline] {
|
// Loop through all of the colors to change the segment colors
|
||||||
color: $bg-color;
|
// based on the toolbar color or if it isn't in a toolbar then based on
|
||||||
|
// the segment color value
|
||||||
|
@each $color-name, $color-value in $colors {
|
||||||
|
$inverse-color-value: inverse($color-value);
|
||||||
|
|
||||||
&.activated {
|
.toolbar[#{$color-name}] {
|
||||||
opacity: 1;
|
|
||||||
color: $bg-color;
|
ion-segment {
|
||||||
border-color: $bg-color;
|
ion-segment-button[button] {
|
||||||
|
@include segment-button($inverse-color-value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through all of the colors again to change the segment colors
|
||||||
|
// for each toolbar based on the segment color
|
||||||
|
// this will take priority over the default toolbar colors
|
||||||
|
@each $color-name, $color-value in $colors {
|
||||||
|
ion-segment[#{$color-name}] {
|
||||||
|
ion-segment-button[button] {
|
||||||
|
@include segment-button($color-value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ion-segment[#{$color-name}] {
|
||||||
|
ion-segment-button[button] {
|
||||||
|
@include segment-button($color-value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,16 +82,44 @@
|
|||||||
<p>Model Style: <b>Model {{ modelStyle }}</b></p>
|
<p>Model Style: <b>Model {{ modelStyle }}</b></p>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<ion-toolbar position="bottom">
|
<ion-toolbar position="bottom" primary>
|
||||||
<ion-segment [(ng-model)]="appType" primary>
|
<ion-segment [(ng-model)]="appType">
|
||||||
<ion-segment-button value="paid">
|
<ion-segment-button value="paid">
|
||||||
Paid
|
Primary
|
||||||
</ion-segment-button>
|
</ion-segment-button>
|
||||||
<ion-segment-button value="free">
|
<ion-segment-button value="free">
|
||||||
Free
|
Toolbar
|
||||||
</ion-segment-button>
|
</ion-segment-button>
|
||||||
<ion-segment-button value="top" class="e2eSegmentTopGrossing">
|
<ion-segment-button value="top" class="e2eSegmentTopGrossing">
|
||||||
Top Grossing
|
Default Segment
|
||||||
|
</ion-segment-button>
|
||||||
|
</ion-segment>
|
||||||
|
</ion-toolbar>
|
||||||
|
|
||||||
|
<ion-toolbar position="bottom" light>
|
||||||
|
<ion-segment [(ng-model)]="appType" primary>
|
||||||
|
<ion-segment-button value="paid">
|
||||||
|
Light
|
||||||
|
</ion-segment-button>
|
||||||
|
<ion-segment-button value="free">
|
||||||
|
Toolbar
|
||||||
|
</ion-segment-button>
|
||||||
|
<ion-segment-button value="top" class="e2eSegmentTopGrossing">
|
||||||
|
Primary Segment
|
||||||
|
</ion-segment-button>
|
||||||
|
</ion-segment>
|
||||||
|
</ion-toolbar>
|
||||||
|
|
||||||
|
<ion-toolbar position="bottom" light>
|
||||||
|
<ion-segment [(ng-model)]="appType">
|
||||||
|
<ion-segment-button value="paid">
|
||||||
|
Light
|
||||||
|
</ion-segment-button>
|
||||||
|
<ion-segment-button value="free">
|
||||||
|
Toolbar
|
||||||
|
</ion-segment-button>
|
||||||
|
<ion-segment-button value="top" class="e2eSegmentTopGrossing">
|
||||||
|
Default Segment
|
||||||
</ion-segment-button>
|
</ion-segment-button>
|
||||||
</ion-segment>
|
</ion-segment>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
@ -13,5 +13,6 @@
|
|||||||
"!./scripts/**",
|
"!./scripts/**",
|
||||||
"!./dist/**",
|
"!./dist/**",
|
||||||
"!./tmp/**"
|
"!./tmp/**"
|
||||||
]
|
],
|
||||||
|
"compileOnSave" : false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user