-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CL] add
hideIfEmpty
input to bit-nav-group (#12046)
- Loading branch information
Showing
3 changed files
with
81 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,56 @@ | ||
<!-- This a higher order component that composes `NavItemComponent` --> | ||
<bit-nav-item | ||
[text]="text" | ||
[icon]="icon" | ||
[route]="route" | ||
[relativeTo]="relativeTo" | ||
[routerLinkActiveOptions]="routerLinkActiveOptions" | ||
[variant]="variant" | ||
[treeDepth]="treeDepth" | ||
(mainContentClicked)="handleMainContentClicked()" | ||
[ariaLabel]="ariaLabel" | ||
[hideActiveStyles]="parentHideActiveStyles" | ||
> | ||
<ng-template #button> | ||
<button | ||
type="button" | ||
class="tw-ml-auto" | ||
[bitIconButton]=" | ||
open ? 'bwi-angle-up' : variant === 'tree' ? 'bwi-angle-right' : 'bwi-angle-down' | ||
" | ||
[buttonType]="'light'" | ||
(click)="toggle($event)" | ||
size="small" | ||
[title]="'toggleCollapse' | i18n" | ||
aria-haspopup="true" | ||
[attr.aria-expanded]="open.toString()" | ||
[attr.aria-controls]="contentId" | ||
[attr.aria-label]="['toggleCollapse' | i18n, text].join(' ')" | ||
></button> | ||
</ng-template> | ||
<ng-container *ngIf="!hideIfEmpty || nestedNavComponents.length > 0"> | ||
<bit-nav-item | ||
[text]="text" | ||
[icon]="icon" | ||
[route]="route" | ||
[relativeTo]="relativeTo" | ||
[routerLinkActiveOptions]="routerLinkActiveOptions" | ||
[variant]="variant" | ||
[treeDepth]="treeDepth" | ||
(mainContentClicked)="handleMainContentClicked()" | ||
[ariaLabel]="ariaLabel" | ||
[hideActiveStyles]="parentHideActiveStyles" | ||
> | ||
<ng-template #button> | ||
<button | ||
type="button" | ||
class="tw-ml-auto" | ||
[bitIconButton]=" | ||
open ? 'bwi-angle-up' : variant === 'tree' ? 'bwi-angle-right' : 'bwi-angle-down' | ||
" | ||
[buttonType]="'light'" | ||
(click)="toggle($event)" | ||
size="small" | ||
[title]="'toggleCollapse' | i18n" | ||
aria-haspopup="true" | ||
[attr.aria-expanded]="open.toString()" | ||
[attr.aria-controls]="contentId" | ||
[attr.aria-label]="['toggleCollapse' | i18n, text].join(' ')" | ||
></button> | ||
</ng-template> | ||
|
||
<!-- Show toggle to the left for trees otherwise to the right --> | ||
<ng-container slot="start" *ngIf="variant === 'tree'"> | ||
<ng-container *ngTemplateOutlet="button"></ng-container> | ||
</ng-container> | ||
<ng-container slot="end"> | ||
<ng-content select="[slot=end]"></ng-content> | ||
<ng-container *ngIf="variant !== 'tree'"> | ||
<!-- Show toggle to the left for trees otherwise to the right --> | ||
<ng-container slot="start" *ngIf="variant === 'tree'"> | ||
<ng-container *ngTemplateOutlet="button"></ng-container> | ||
</ng-container> | ||
</ng-container> | ||
</bit-nav-item> | ||
<ng-container slot="end"> | ||
<ng-content select="[slot=end]"></ng-content> | ||
<ng-container *ngIf="variant !== 'tree'"> | ||
<ng-container *ngTemplateOutlet="button"></ng-container> | ||
</ng-container> | ||
</ng-container> | ||
</bit-nav-item> | ||
|
||
<!-- [attr.aria-controls] of the above button expects a unique ID on the controlled element --> | ||
<ng-container *ngIf="sideNavService.open$ | async"> | ||
<div | ||
*ngIf="open" | ||
[attr.id]="contentId" | ||
[attr.aria-label]="[text, 'submenu' | i18n].join(' ')" | ||
role="group" | ||
> | ||
<ng-content></ng-content> | ||
</div> | ||
<!-- [attr.aria-controls] of the above button expects a unique ID on the controlled element --> | ||
<ng-container *ngIf="sideNavService.open$ | async"> | ||
<div | ||
*ngIf="open" | ||
[attr.id]="contentId" | ||
[attr.aria-label]="[text, 'submenu' | i18n].join(' ')" | ||
role="group" | ||
> | ||
<ng-content></ng-content> | ||
</div> | ||
</ng-container> | ||
</ng-container> |
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