Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit ea38118

Browse files
feat(feature-discovery): support ion-icon
Co-authored-by: Gary Großgarten <gary@fivethree.io>
1 parent ff3035f commit ea38118

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

projects/core/ng-package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
"@ionic/angular": "ionic-angular",
99
"hammerjs": "Hammer"
1010
}
11-
}
11+
},
12+
"whitelistedNonPeerDependencies": [
13+
"@fivethree/ngx-rxjs-animations"
14+
]
1215
}

projects/core/ng-package.prod.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@
99
"@ionic/angular": "ionic-angular",
1010
"hammerjs": "Hammer"
1111
}
12-
}
12+
},
13+
"whitelistedNonPeerDependencies": [
14+
"@fivethree/ngx-rxjs-animations"
15+
]
1316
}

projects/core/src/lib/feature-discovery/feature-discovery.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Platform } from '@ionic/angular';
1+
import { Platform, IonIcon } from '@ionic/angular';
22
import {
33
Component,
44
OnInit,
@@ -180,7 +180,7 @@ export class FivFeatureDiscovery implements OnInit, AfterContentInit {
180180
this.animationState = 'execute';
181181
}
182182

183-
setIcon(icon: FivIcon) {
183+
setIcon(icon: FivIcon | IonIcon) {
184184
if (icon) {
185185
this.icon = icon.name;
186186
}

projects/core/src/lib/feature-discovery/feature.directive.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
import { FivOverlayService } from '../overlay/overlay.service';
1616
import { FivFeatureDiscovery } from './feature-discovery.component';
1717
import { first, filter } from 'rxjs/operators';
18-
import { Platform } from '@ionic/angular';
18+
import { Platform, IonIcon } from '@ionic/angular';
1919

2020
@Directive({
2121
selector: '[fivFeature]',
@@ -41,7 +41,8 @@ export class FivFeature {
4141
constructor(
4242
@Host() private host: ElementRef,
4343
private viewContainer: ViewContainerRef,
44-
@Host() @Optional() private icon: FivIcon,
44+
@Host() @Optional() private fivIcon: FivIcon,
45+
@Host() @Optional() private ionIcon: IonIcon,
4546
private overlay: FivOverlayService,
4647
private platform: Platform
4748
) {}
@@ -57,7 +58,8 @@ export class FivFeature {
5758
}
5859

5960
show() {
60-
const bounds = this.icon
61+
const icon = this.ionIcon || this.fivIcon;
62+
const bounds = icon
6163
? this.getBounds(this.host.nativeElement.parentElement)
6264
: this.getBounds(this.host.nativeElement);
6365

@@ -71,7 +73,7 @@ export class FivFeature {
7173
featureOverlay.width = this.diameter;
7274
featureOverlay.featurePadding = this.featurePadding;
7375
featureOverlay.contentOffset = this.contentOffset;
74-
featureOverlay.setIcon(this.icon);
76+
featureOverlay.setIcon(icon);
7577
featureOverlay.setBounds(bounds);
7678
featureOverlay.show();
7779
this.fivWillOpen.emit();

0 commit comments

Comments
 (0)