Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Click event/touchable (#131)
Browse files Browse the repository at this point in the history
* add screen and click events in beagle angular components

* add click event in touchable component

* add click event in touchable component

Co-authored-by: Tiago Peres França <[email protected]>
  • Loading branch information
leonardosantiagozup and Tiagoperes authored Jun 26, 2020
1 parent 904daba commit 52382b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/beagle-touchable/beagle-touchable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/

import { Component, Input, ViewEncapsulation } from '@angular/core'
import { ClickEvent } from '@zup-it/beagle-web/types'
import { BeagleAnalytics } from '@zup-it/beagle-web'
import { BeagleTouchableInterface } from '../schemas/touchable'

@Component({
Expand All @@ -25,8 +27,13 @@ import { BeagleTouchableInterface } from '../schemas/touchable'
})
export class BeagleTouchableComponent implements BeagleTouchableInterface {
@Input() onPress: () => void
@Input() clickAnalyticsEvent?: ClickEvent
beagleAnalytics = BeagleAnalytics.getAnalytics()

handleClick() {
if (this.clickAnalyticsEvent && this.beagleAnalytics) {
this.beagleAnalytics.trackEventOnClick(this.clickAnalyticsEvent)
}
if (this.onPress) this.onPress()
}
}
3 changes: 3 additions & 0 deletions src/components/schemas/touchable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* limitations under the License.
*/

import { ClickEvent } from '@zup-it/beagle-web/types'

export interface BeagleTouchableInterface {
onPress: () => void,
clickAnalyticsEvent?: ClickEvent,
}

0 comments on commit 52382b7

Please sign in to comment.