feat(): add action-sheet role classes

This commit is contained in:
mhartington
2017-08-08 12:45:28 -04:00
parent f33af0623f
commit c1e2133461

View File

@ -5,7 +5,7 @@ import {
EventEmitter, EventEmitter,
Listen, Listen,
Prop, Prop,
State CssClassMap
} from '@stencil/core'; } from '@stencil/core';
import { AnimationBuilder, Animation, Ionic } from '../../index'; import { AnimationBuilder, Animation, Ionic } from '../../index';
@ -25,7 +25,6 @@ import iOSLeaveAnimation from './animations/ios.leave';
}) })
export class ActionSheet { export class ActionSheet {
private animation: Animation; private animation: Animation;
private durationTimeout: any;
@Element() private el: HTMLElement; @Element() private el: HTMLElement;
@ -162,7 +161,8 @@ export class ActionSheet {
? <div class="action-sheet-sub-title">{this.subTitle}</div> ? <div class="action-sheet-sub-title">{this.subTitle}</div>
: null} : null}
{this.buttons.map(b => {this.buttons.map(b =>
<button class="action-sheet-button" onClick={() => this.click(b)}> <button class={this.buttonClass(b)}
onClick={() => this.click(b)}>
{b.icon {b.icon
? <ion-icon name={b.icon} class="action-sheet-icon" /> ? <ion-icon name={b.icon} class="action-sheet-icon" />
: null} : null}
@ -174,6 +174,17 @@ export class ActionSheet {
</div> </div>
]; ];
} }
buttonClass(button: ActionSheetButton): CssClassMap {
let buttonClass: string[] = !button.role
? ['action-sheet-button']
: [`action-sheet-button`, `action-sheet-${button.role}`]
return buttonClass.reduce((prevValue: any, cssClass: any) => {
prevValue[cssClass] = true;
return prevValue;
}, {});
}
} }
export interface ActionSheetOptions { export interface ActionSheetOptions {