-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom landing page provider, navigation to landing page via title
This allows to override the default message to select a component from the side nav. You can also navigate back to the landing page now via clicking on the title anchor.
- Loading branch information
1 parent
8b520d5
commit de37f9c
Showing
12 changed files
with
90 additions
and
18 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
apps/component-doc-portal/src/app/custom-landing-page.component.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,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
template: `<h1> | ||
Custom Landing Page! Please select a component document from the side | ||
navigation | ||
</h1>`, | ||
}) | ||
export class CustomLandingPageComponent {} |
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
4 changes: 3 additions & 1 deletion
4
libs/ng-doc-portal/src/lib/components/side-nav/side-nav.component.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
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
26 changes: 26 additions & 0 deletions
26
libs/ng-doc-portal/src/lib/pages/landing-page/landing-page.component.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,26 @@ | ||
import { NgComponentOutlet, NgIf } from '@angular/common'; | ||
import { Component, Inject, Optional, Type } from '@angular/core'; | ||
|
||
import { NG_DOC_PORTAL_LANDING_PAGE_TOKEN } from './landing-page.token'; | ||
|
||
@Component({ | ||
selector: 'ngdp-landing-page', | ||
standalone: true, | ||
template: ` | ||
<ng-container *ngIf="!landingPageOverride"> | ||
<h1>Please select a component document page from the side navigation.</h1> | ||
</ng-container> | ||
<ng-container | ||
*ngIf="landingPageOverride" | ||
[ngComponentOutlet]="landingPageOverride" | ||
></ng-container> | ||
`, | ||
imports: [NgIf, NgComponentOutlet], | ||
}) | ||
export class LandingPageComponent { | ||
constructor( | ||
@Optional() | ||
@Inject(NG_DOC_PORTAL_LANDING_PAGE_TOKEN) | ||
public landingPageOverride?: Type<any> | ||
) {} | ||
} |
14 changes: 14 additions & 0 deletions
14
libs/ng-doc-portal/src/lib/pages/landing-page/landing-page.token.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,14 @@ | ||
import { InjectionToken, Provider, Type } from '@angular/core'; | ||
|
||
export const NG_DOC_PORTAL_LANDING_PAGE_TOKEN = new InjectionToken<Type<any>>( | ||
'NG_DOC_PORTAL_LANDING_PAGE_TOKEN' | ||
); | ||
|
||
export function ngDocPortalProvideLandingPage( | ||
landingPage: Type<any> | ||
): Provider { | ||
return { | ||
provide: NG_DOC_PORTAL_LANDING_PAGE_TOKEN, | ||
useValue: landingPage, | ||
}; | ||
} |
10 changes: 0 additions & 10 deletions
10
libs/ng-doc-portal/src/lib/pages/no-selection-page/no-selection-page.component.ts
This file was deleted.
Oops, something went wrong.
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
6 changes: 5 additions & 1 deletion
6
...s/components/pages/no-selection-page.scss → ...styles/components/pages/landing-page.scss
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 |
---|---|---|
@@ -1,7 +1,11 @@ | ||
ngdp-no-selection-page { | ||
ngdp-landing-page { | ||
height: 100%; | ||
width: 100%; | ||
display: grid; | ||
grid-template-columns: 1fr; | ||
justify-items: center; | ||
|
||
& > h1 { | ||
margin-top: 24px; | ||
} | ||
} |
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