fix(item): add disabled property and styles

This commit is contained in:
Brandy Carney
2018-02-13 19:48:33 -05:00
parent 7f817a908f
commit b86861170c
4 changed files with 28 additions and 1 deletions

View File

@ -1438,6 +1438,7 @@ declare global {
namespace JSXElements { namespace JSXElements {
export interface IonItemAttributes extends HTMLAttributes { export interface IonItemAttributes extends HTMLAttributes {
color?: string; color?: string;
disabled?: boolean;
href?: string; href?: string;
mode?: 'ios' | 'md'; mode?: 'ios' | 'md';
onclick?: (this: HTMLElement, ev: MouseEvent) => any; onclick?: (this: HTMLElement, ev: MouseEvent) => any;

View File

@ -105,3 +105,9 @@ ion-input.item {
.item .button { .item .button {
@include margin(0); @include margin(0);
} }
.item-disabled {
cursor: default;
opacity: .4;
pointer-events: none;
}

View File

@ -31,6 +31,11 @@ export class Item {
*/ */
@Prop() mode: 'ios' | 'md'; @Prop() mode: 'ios' | 'md';
/**
* If true, the user cannot interact with the item. Defaults to `false`.
*/
@Prop() disabled = false;
/** /**
* Contains a URL or a URL fragment that the hyperlink points to. * Contains a URL or a URL fragment that the hyperlink points to.
* If this property is set, an anchor tag will be rendered. * If this property is set, an anchor tag will be rendered.
@ -95,7 +100,8 @@ export class Item {
...childStyles, ...childStyles,
...createThemedClasses(this.mode, this.color, 'item'), ...createThemedClasses(this.mode, this.color, 'item'),
...getElementClassMap(this.el.classList), ...getElementClassMap(this.el.classList),
'item-block': true 'item-block': true,
'item-disabled': this.disabled,
}; };
this.hasStyleChange = false; this.hasStyleChange = false;

View File

@ -16,6 +16,13 @@ Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"da
For more information, see [Theming your App](/docs/theming/theming-your-app). For more information, see [Theming your App](/docs/theming/theming-your-app).
#### disabled
boolean
If true, the user cannot interact with the item. Defaults to `false`.
#### href #### href
string string
@ -60,6 +67,13 @@ Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"da
For more information, see [Theming your App](/docs/theming/theming-your-app). For more information, see [Theming your App](/docs/theming/theming-your-app).
#### disabled
boolean
If true, the user cannot interact with the item. Defaults to `false`.
#### href #### href
string string