md segment wip

This commit is contained in:
Adam Bradley
2015-12-07 16:45:24 -06:00
parent 53356f6b08
commit 3143091d63
4 changed files with 59 additions and 65 deletions

View File

@ -13,10 +13,7 @@ $segment-button-md-border-color-activated: map-get($colors-md, primary) !def
$segment-button-md-border-bottom: 2px solid rgba(#000000, 0.10) !default; $segment-button-md-border-bottom: 2px solid rgba(#000000, 0.10) !default;
ion-segment { .segment-button {
button,
[button] {
border-width: 0; border-width: 0;
transition: 100ms all linear; transition: 100ms all linear;
font-size: $segment-button-md-font-size; font-size: $segment-button-md-font-size;
@ -25,7 +22,8 @@ ion-segment {
min-height: $segment-button-md-min-height; min-height: $segment-button-md-min-height;
line-height: $segment-button-md-line-height; line-height: $segment-button-md-line-height;
&.activated, &.segment-activated { &.activated,
&.segment-activated {
color: $segment-button-md-text-color-activated; color: $segment-button-md-text-color-activated;
background-color: transparent; background-color: transparent;
border-color: $segment-button-md-border-color-activated; border-color: $segment-button-md-border-color-activated;
@ -35,15 +33,13 @@ ion-segment {
border-bottom: $segment-button-md-border-bottom; border-bottom: $segment-button-md-border-bottom;
} }
}
.toolbar { .toolbar {
ion-segment { ion-segment {
margin: 0 auto; margin: 0 auto;
ion-segment-button[button][outline].activated, .segment-button.activated,
ion-segment-button[button][outline].segment-activated { .segment-button.segment-activated {
background-color: transparent; background-color: transparent;
opacity: 1; opacity: 1;
} }
@ -57,7 +53,6 @@ ion-segment {
@mixin segment-button($button-color) { @mixin segment-button($button-color) {
background-color: transparent; background-color: transparent;
&[outline] {
color: $button-color; color: $button-color;
&.activated, &.segment-activated { &.activated, &.segment-activated {
@ -67,7 +62,6 @@ ion-segment {
opacity: 1; opacity: 1;
} }
} }
}
// Loop through all of the colors to change the segment colors // 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 // based on the toolbar color or if it isn't in a toolbar then based on
@ -78,7 +72,7 @@ ion-segment {
.toolbar[#{$color-name}] { .toolbar[#{$color-name}] {
ion-segment { ion-segment {
ion-segment-button[button] { .segment-button {
@include segment-button($inverse-color-value); @include segment-button($inverse-color-value);
} }
} }
@ -88,7 +82,7 @@ ion-segment {
// this will take priority over the default toolbar colors // this will take priority over the default toolbar colors
@each $color-name, $color-value in $colors-md { @each $color-name, $color-value in $colors-md {
ion-segment[#{$color-name}] { ion-segment[#{$color-name}] {
ion-segment-button[button] { .segment-button {
@include segment-button($color-value); @include segment-button($color-value);
} }
} }
@ -97,7 +91,7 @@ ion-segment {
} }
ion-segment[#{$color-name}] { ion-segment[#{$color-name}] {
ion-segment-button[button] { .segment-button {
@include segment-button($color-value); @include segment-button($color-value);
} }

View File

@ -7,24 +7,23 @@ $segment-button-padding: 0 16px !default;
ion-segment { ion-segment {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex: 1; flex: 1;
width: 100%; width: 100%;
}
button, .segment-button {
[button] { position: relative;
overflow: hidden;
display: block;
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
padding: $segment-button-padding;
flex: 1; flex: 1;
display: block;
overflow: hidden;
padding: $segment-button-padding;
width: 0; width: 0;
border-width: 1px 0px 1px 1px; border-width: 1px 0px 1px 1px;
@ -36,4 +35,3 @@ ion-segment {
background: none; background: none;
} }
}

View File

@ -177,7 +177,7 @@ export class Segment extends Ion {
], ],
host: { host: {
'(click)': 'click($event)', '(click)': 'click($event)',
'[class.segment-activated]': 'isActive', '[class.segment-activated]': 'isActive'
} }
}) })
export class SegmentButton { export class SegmentButton {
@ -189,8 +189,8 @@ export class SegmentButton {
) { ) {
this.segment = segment; this.segment = segment;
renderer.setElementAttribute(elementRef, 'button', ''); renderer.setElementClass(elementRef, 'segment-button', true);
renderer.setElementAttribute(elementRef, 'outline', ''); renderer.setElementAttribute(elementRef, 'tappable', '');
} }
/** /**

View File

@ -274,6 +274,7 @@ ion-buttons[right] {
// iOS Toolbar Menu Toggle // iOS Toolbar Menu Toggle
// -------------------------------------------------- // --------------------------------------------------
.toolbar {
[menu-toggle] { [menu-toggle] {
order: map-get($toolbar-order-ios, menu-toggle-start); order: map-get($toolbar-order-ios, menu-toggle-start);
cursor: pointer; cursor: pointer;
@ -283,6 +284,7 @@ ion-buttons[right] {
[menu-toggle][right] { [menu-toggle][right] {
order: map-get($toolbar-order-ios, menu-toggle-end); order: map-get($toolbar-order-ios, menu-toggle-end);
} }
}
ion-segment-button[button] { ion-segment-button[button] {
line-height: 2.4rem; line-height: 2.4rem;