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,33 +39,62 @@ ion-segment {
|
||||
|
||||
ion-segment {
|
||||
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 {
|
||||
|
||||
ion-segment[#{$color}] {
|
||||
|
||||
ion-segment-button[button] {
|
||||
$bg-color: $value;
|
||||
$text-color: inverse($bg-color);
|
||||
|
||||
@mixin segment-button($button-color) {
|
||||
background-color: transparent;
|
||||
color: $text-color;
|
||||
|
||||
&[outline] {
|
||||
color: $bg-color;
|
||||
color: $button-color;
|
||||
|
||||
&.activated {
|
||||
background-color: transparent;
|
||||
color: $button-color;
|
||||
border-color: $button-color;
|
||||
opacity: 1;
|
||||
color: $bg-color;
|
||||
border-color: $bg-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through all of the colors to change the segment colors
|
||||
// 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);
|
||||
|
||||
.toolbar[#{$color-name}] {
|
||||
|
||||
ion-segment {
|
||||
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>
|
||||
</ion-content>
|
||||
|
||||
<ion-toolbar position="bottom">
|
||||
<ion-segment [(ng-model)]="appType" primary>
|
||||
<ion-toolbar position="bottom" primary>
|
||||
<ion-segment [(ng-model)]="appType">
|
||||
<ion-segment-button value="paid">
|
||||
Paid
|
||||
Primary
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="free">
|
||||
Free
|
||||
Toolbar
|
||||
</ion-segment-button>
|
||||
<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>
|
||||
</ion-toolbar>
|
||||
|
@ -13,5 +13,6 @@
|
||||
"!./scripts/**",
|
||||
"!./dist/**",
|
||||
"!./tmp/**"
|
||||
]
|
||||
],
|
||||
"compileOnSave" : false
|
||||
}
|
||||
|
Reference in New Issue
Block a user