-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(notification-panel): add scroll strategy provider (#537)
- Loading branch information
Igor Milly
authored and
GitHub Enterprise
committed
Mar 16, 2022
1 parent
3561416
commit 2248cea
Showing
7 changed files
with
112 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
44 changes: 44 additions & 0 deletions
44
...n-panel-scroll-strategy-provider/notification-panel-scroll-strategy-provider-example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<button | ||
nxIconButton="small tertiary" | ||
class="nx-margin-0" | ||
[nxNotificationPanelTriggerFor]="panel1" | ||
title="Notifications" | ||
> | ||
<nx-icon name="bell-o"></nx-icon> | ||
</button> | ||
|
||
<ng-template #panel1> | ||
<nx-notification-panel> | ||
<nx-notification-header> | ||
<h3 nxCopytext="large" class="nx-font-weight-semibold">Unread</h3> | ||
<button nxPlainButton="small" type="button" | ||
>Mark all as read | ||
<nx-icon name="check" class="nx-margin-left-2xs"></nx-icon | ||
></button> | ||
</nx-notification-header> | ||
|
||
<a nxNotificationPanelItem clickable="false" [attr.href]="null"> | ||
<nx-notification-item-metadata> | ||
<nx-icon | ||
size="s" | ||
class="nx-margin-right-2xs" | ||
name="lock-o" | ||
aria-hidden="true" | ||
></nx-icon | ||
>File lock release · 16:53 | ||
</nx-notification-item-metadata> | ||
<nx-notification-item-content> | ||
<span class="nx-font-weight-semibold" | ||
>The file you tried to edit (XY12345) is now | ||
available.</span | ||
> | ||
</nx-notification-item-content> | ||
<nx-notification-item-actions> | ||
<nx-link><a href="#file-link">Edit file</a></nx-link> | ||
<button nxPlainButton="small" type="button" title="Delete"> | ||
<nx-icon name="trash-o" aria-hidden="true"></nx-icon> | ||
</button> | ||
</nx-notification-item-actions> | ||
</a> | ||
</nx-notification-panel> | ||
</ng-template> |
24 changes: 24 additions & 0 deletions
24
...ion-panel-scroll-strategy-provider/notification-panel-scroll-strategy-provider-example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Overlay, ScrollStrategy } from '@angular/cdk/overlay'; | ||
import { Component } from '@angular/core'; | ||
import { NX_NOTIFICATION_PANEL_SCROLL_STRATEGY } from '@aposin/ng-aquila/notification-panel'; | ||
|
||
function scrollStrategyFactory(overlay: Overlay): () => ScrollStrategy { | ||
return () => overlay.scrollStrategies.close({ threshold: 100 }); | ||
} | ||
|
||
/** | ||
* @title Scroll Strategy Provider Example | ||
*/ | ||
@Component({ | ||
selector: 'notification-panel-scroll-strategy-provider-example', | ||
templateUrl: './notification-panel-scroll-strategy-provider-example.html', | ||
styleUrls: ['./notification-panel-scroll-strategy-provider-example.css'], | ||
providers: [ | ||
{ | ||
provide: NX_NOTIFICATION_PANEL_SCROLL_STRATEGY, | ||
useFactory: scrollStrategyFactory, | ||
deps: [Overlay], | ||
}, | ||
], | ||
}) | ||
export class NotificationPanelScrollStrategyProviderExampleComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters