Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(addon-doc): support external link in navigation #7030

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 109 additions & 53 deletions projects/addon-doc/components/navigation/navigation.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,40 @@
*ngFor="let group of filtered$ | async; let index = index"
[label]="labels[index] || ''"
>
<a
*ngFor="let item of group"
tuiOption
[attr.rel]="item.rel"
[fragment]="item.fragment"
[routerLink]="item.route"
[target]="item.target || '_self'"
(click)="onClick(input)"
>
{{ item.title }}
<tui-svg
*polymorpheusOutlet="item.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>
<ng-container *ngFor="let item of group">
<a
*ngIf="item.route.includes('://'); else internal"
tuiOption
[attr.rel]="item.rel"
[href]="item.route"
[target]="item.target || '_self'"
>
{{ item.title }}
<tui-svg
*polymorpheusOutlet="item.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>

<ng-template #internal>
<a
tuiOption
[attr.rel]="item.rel"
[fragment]="item.fragment"
[routerLink]="item.route"
[target]="item.target || '_self'"
(click)="onClick(input)"
>
{{ item.title }}
<tui-svg
*polymorpheusOutlet="item.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>
</ng-template>
</ng-container>
</tui-opt-group>
</tui-data-list>
</ng-container>
Expand Down Expand Up @@ -78,24 +96,43 @@
let-index="index"
let-item="item"
>
<a
*ngIf="!item.subPages; else subPagesTemplate"
routerLinkActive="t-sublink_active"
tuiLink
class="t-sublink"
[attr.rel]="item.rel"
[routerLink]="item.route"
[target]="item.target || '_self'"
[tuiScrollIntoViewLink]="isActive(item.route)"
(click)="closeMenu()"
>
{{ item.title }}
<tui-svg
*polymorpheusOutlet="item.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>
<ng-container *ngIf="!item.subPages; else subPagesTemplate">
<a
*ngIf="item.route.includes('://'); else internal"
tuiLink
class="t-sublink"
[attr.rel]="item.rel"
[href]="item.route"
[target]="item.target || '_self'"
>
{{ item.title }}
<tui-svg
*polymorpheusOutlet="item.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>

<ng-template #internal>
<a
routerLinkActive="t-sublink_active"
tuiLink
class="t-sublink"
[attr.rel]="item.rel"
[routerLink]="item.route"
[target]="item.target || '_self'"
[tuiScrollIntoViewLink]="isActive(item.route)"
(click)="closeMenu()"
>
{{ item.title }}
<tui-svg
*polymorpheusOutlet="item.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>
</ng-template>
</ng-container>

<ng-template #subPagesTemplate>
<div
Expand Down Expand Up @@ -127,25 +164,44 @@
[expanded]="!!openPagesGroupsArr[index]"
>
<div class="t-section t-section_bordered">
<a
*ngFor="let subPage of $pages(item.subPages)"
routerLinkActive="t-sublink_active"
tuiLink
class="t-sublink t-sublink_small"
[attr.rel]="subPage.rel"
[fragment]="subPage.fragment"
[routerLink]="subPage.route"
[target]="subPage.target || '_self'"
[tuiScrollIntoViewLink]="isActive(subPage.route)"
(click)="closeMenu()"
>
{{ subPage.title }}
<tui-svg
*polymorpheusOutlet="subPage.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>
<ng-container *ngFor="let subPage of $pages(item.subPages)">
<a
*ngIf="subPage.route.includes('://'); else internal"
tuiLink
class="t-sublink t-sublink_small"
[attr.rel]="subPage.rel"
[href]="subPage.route"
[target]="subPage.target || '_self'"
>
{{ subPage.title }}
<tui-svg
*polymorpheusOutlet="subPage.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>

<ng-template #internal>
<a
routerLinkActive="t-sublink_active"
tuiLink
class="t-sublink t-sublink_small"
[attr.rel]="subPage.rel"
[fragment]="subPage.fragment"
[routerLink]="subPage.route"
[target]="subPage.target || '_self'"
[tuiScrollIntoViewLink]="isActive(subPage.route)"
(click)="closeMenu()"
>
{{ subPage.title }}
<tui-svg
*polymorpheusOutlet="subPage.icon as icon"
class="t-icon"
[src]="icon"
></tui-svg>
</a>
</ng-template>
</ng-container>
</div>
</tui-expand>
</div>
Expand Down
3 changes: 2 additions & 1 deletion projects/demo-playwright/tests/demo/get-demo-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export function tuiGetDemoPathsForE2E(
.filter(
page =>
!exclusionSection.includes(page.section!) &&
!exclusionRoutes.includes(page.route),
!exclusionRoutes.includes(page.route) &&
!page.route.includes('://'),
)
.map(({route}) => route),
),
Expand Down
7 changes: 7 additions & 0 deletions projects/demo/src/modules/app/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,13 @@ export const pages: TuiDocPages = [
},
],
},
{
section: 'Components',
title: 'ColorPicker',
keywords: 'color, picker, input, color',
route: 'https://taiga-family.github.io/tui-editor/color-picker',
target: '_blank',
},
{
section: 'Components',
title: 'Island',
Expand Down
Loading