Skip to content

Commit

Permalink
Event output (#43)
Browse files Browse the repository at this point in the history
* add output event with status information for sticky components

* bump version 1.1.3
  • Loading branch information
Tobias Cabrera Cano authored Oct 23, 2019
1 parent fdc24f3 commit 7ab98f6
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 15 deletions.
43 changes: 31 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-sticky-things-demo",
"version": "1.1.2",
"version": "1.1.3",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
5 changes: 5 additions & 0 deletions projects/angular-sticky-things/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/angular-sticky-things/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@w11k/angular-sticky-things",
"version": "1.1.2",
"version": "1.1.3",
"peerDependencies": {
"@angular/common": "^4.0.0 || ^8.0.0",
"@angular/core": "^4.0.0 || ^8.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
AfterViewInit,
Directive,
ElementRef,
EventEmitter,
HostBinding,
HostListener,
Inject,
Input,
isDevMode,
OnDestroy,
OnInit,
Output,
PLATFORM_ID
} from '@angular/core';
import {isPlatformBrowser} from '@angular/common';
Expand Down Expand Up @@ -56,8 +58,8 @@ export class StickyThingDirective implements OnInit, AfterViewInit, OnDestroy {
@Input('boundary') boundaryElement: HTMLElement | undefined;

@HostBinding('class.is-sticky') sticky = false;

@HostBinding('class.boundary-reached') boundaryReached = false;
@Output() stickyStatus: EventEmitter<StickyStatus> = new EventEmitter<StickyStatus>();

/**
* The field represents some position values in normal (not sticky) mode.
Expand Down Expand Up @@ -295,6 +297,7 @@ Then pass the spacer element as input:
} else {
this.removeSticky();
}
this.stickyStatus.next(status);
}

private removeSticky(): void {
Expand Down
8 changes: 8 additions & 0 deletions src/app/home/home.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
display: block;
}

.is-sticky {
transform: scale(1.2);
}

.boundary-reached {
transform: scale(1);
}

section {
min-height: 100vh;
}
Expand Down

0 comments on commit 7ab98f6

Please sign in to comment.