Skip to content

Commit

Permalink
feat(addon-doc): support icons inside menu
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Sep 20, 2023
1 parent 2921a21 commit 0b82cc3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
}
}

.t-icon {
margin-left: 0.5rem;
}

.t-chevron {
.transition(transform);
width: 1rem;
Expand Down
25 changes: 25 additions & 0 deletions projects/addon-doc/components/navigation/navigation.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
(click)="onClick(input)"
>
{{ item.title }}
<ng-container *polymorpheusOutlet="item.icon as icon">
<tui-svg
class="t-icon"
[src]="icon"
></tui-svg>
</ng-container>
</a>
</tui-opt-group>
</tui-data-list>
Expand Down Expand Up @@ -81,7 +87,14 @@
(click)="closeMenu()"
>
{{ item.title }}
<ng-container *polymorpheusOutlet="item.icon as icon">
<tui-svg
class="t-icon"
[src]="icon"
></tui-svg>
</ng-container>
</a>

<ng-template #subPagesTemplate>
<div
routerLinkActive
Expand All @@ -101,6 +114,12 @@
[src]="icons.more"
></tui-svg>
{{ item.title }}
<ng-container *polymorpheusOutlet="item.icon as icon">
<tui-svg
class="t-icon"
[src]="icon"
></tui-svg>
</ng-container>
</button>
<tui-expand
class="t-expand"
Expand All @@ -118,6 +137,12 @@
(click)="closeMenu()"
>
{{ subPage.title }}
<ng-container *polymorpheusOutlet="item.icon as icon">
<tui-svg
class="t-icon"
[src]="icon"
></tui-svg>
</ng-container>
</a>
</div>
</tui-expand>
Expand Down
3 changes: 3 additions & 0 deletions projects/addon-doc/interfaces/page.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

export interface TuiDocPageBase {
readonly section?: string;
readonly title: string;
Expand All @@ -7,6 +9,7 @@ export interface TuiDocPage extends TuiDocPageBase {
readonly fragment?: string;
readonly keywords?: string;
readonly route: string;
readonly icon?: PolymorpheusContent;
}

export interface TuiDocPageGroup extends TuiDocPageBase {
Expand Down
4 changes: 3 additions & 1 deletion projects/demo/src/modules/app/pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const pages = [
import {TuiDocPages} from '@taiga-ui/addon-doc';

export const pages: TuiDocPages = [
// Documentation
{
section: `Documentation`,
Expand Down

0 comments on commit 0b82cc3

Please sign in to comment.