Skip to content

Commit

Permalink
fix(fab-button): add routerDirection
Browse files Browse the repository at this point in the history
fixes #15551
  • Loading branch information
manucorporat committed Sep 12, 2018
1 parent fcb45d1 commit 2398634
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions angular/src/directives/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ export class Fab {
}

export declare interface FabButton extends StencilComponents<'IonFabButton'> {}
@Component({ selector: 'ion-fab-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '<ng-content></ng-content>', inputs: ['mode', 'color', 'activated', 'disabled', 'href', 'translucent', 'show'] })
@Component({ selector: 'ion-fab-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '<ng-content></ng-content>', inputs: ['mode', 'color', 'activated', 'disabled', 'routerDirection', 'href', 'translucent', 'show'] })
export class FabButton {

constructor(r: ElementRef) {
const el = r.nativeElement;
proxyInputs(this, el, ['mode', 'color', 'activated', 'disabled', 'href', 'translucent', 'show']);
proxyInputs(this, el, ['mode', 'color', 'activated', 'disabled', 'routerDirection', 'href', 'translucent', 'show']);
}
}

Expand Down
8 changes: 8 additions & 0 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,10 @@ export namespace Components {
*/
'mode': Mode;
/**
* When using a router, it specifies the transition direction when navigating to another page using `href`.
*/
'routerDirection'?: RouterDirection;
/**
* If true, the fab button will show when in a fab-list.
*/
'show': boolean;
Expand Down Expand Up @@ -1428,6 +1432,10 @@ export namespace Components {
*/
'mode'?: Mode;
/**
* When using a router, it specifies the transition direction when navigating to another page using `href`.
*/
'routerDirection'?: RouterDirection;
/**
* If true, the fab button will show when in a fab-list.
*/
'show'?: boolean;
Expand Down
13 changes: 11 additions & 2 deletions core/src/components/fab-button/fab-button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Element, Prop } from '@stencil/core';

import { Color, CssClassMap, Mode } from '../../interface';
import { createColorClasses } from '../../utils/theme';
import { Color, CssClassMap, Mode, RouterDirection } from '../../interface';
import { createColorClasses, openURL } from '../../utils/theme';

@Component({
tag: 'ion-fab-button',
Expand All @@ -14,6 +14,8 @@ import { createColorClasses } from '../../utils/theme';
export class FabButton {
private inList = false;

@Prop({ context: 'window' }) win!: Window;

@Element() el!: HTMLElement;

/**
Expand All @@ -39,6 +41,12 @@ export class FabButton {
*/
@Prop() disabled = false;

/**
* When using a router, it specifies the transition direction when navigating to
* another page using `href`.
*/
@Prop() routerDirection?: RouterDirection;

/**
* Contains a URL or a URL fragment that the hyperlink points to.
* If this property is set, an anchor tag will be rendered.
Expand Down Expand Up @@ -94,6 +102,7 @@ export class FabButton {
class="fab-button-native"
disabled={this.disabled}
href={this.href}
onClick={ev => openURL(this.win, this.href, ev, this.routerDirection)}
>
<span class="fab-button-close-icon">
<ion-icon name="close" lazy={false}></ion-icon>
Expand Down
19 changes: 10 additions & 9 deletions core/src/components/fab-button/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ If the FAB button is not wrapped with `<ion-fab>`, it will scroll with the conte

## Properties

| Property | Attribute | Description | Type |
| ------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| `activated` | `activated` | If true, the fab button will be show a close icon. Defaults to `false`. | `boolean` |
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
| `disabled` | `disabled` | If true, the user cannot interact with the fab button. Defaults to `false`. | `boolean` |
| `href` | `href` | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | `string` |
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
| `show` | `show` | If true, the fab button will show when in a fab-list. | `boolean` |
| `translucent` | `translucent` | If true, the fab button will be translucent. Defaults to `false`. | `boolean` |
| Property | Attribute | Description | Type |
| ----------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `activated` | `activated` | If true, the fab button will be show a close icon. Defaults to `false`. | `boolean` |
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
| `disabled` | `disabled` | If true, the user cannot interact with the fab button. Defaults to `false`. | `boolean` |
| `href` | `href` | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | `string` |
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
| `routerDirection` | `router-direction` | When using a router, it specifies the transition direction when navigating to another page using `href`. | `RouterDirection` |
| `show` | `show` | If true, the fab button will show when in a fab-list. | `boolean` |
| `translucent` | `translucent` | If true, the fab button will be translucent. Defaults to `false`. | `boolean` |


----------------------------------------------
Expand Down

0 comments on commit 2398634

Please sign in to comment.