diff --git a/src/app/core/animations.ts b/src/app/core/animations.ts
new file mode 100644
index 00000000..ebb2429b
--- /dev/null
+++ b/src/app/core/animations.ts
@@ -0,0 +1,11 @@
+import {trigger, state, transition, animate, style} from '@angular/animations';
+
+export class Animations
+{
+ public static slideInOut = trigger('slideInOut', [
+ state('0', style({height: '0px', display: 'none'})),
+ state('1', style({height: '*', display: 'block'})),
+ transition('1 => 0', animate('300ms ease-out')),
+ transition('0 => 1', animate('300ms ease-in'))
+ ]);
+}
diff --git a/src/app/navigation/nav-collapse/nav-collapse.component.html b/src/app/navigation/nav-collapse/nav-collapse.component.html
index 9d9089cf..8cc4e9aa 100644
--- a/src/app/navigation/nav-collapse/nav-collapse.component.html
+++ b/src/app/navigation/nav-collapse/nav-collapse.component.html
@@ -1,8 +1,9 @@
- {{item.icon}}
+ {{item.icon}}
{{item.title}}
+ keyboard_arrow_right
-
+
diff --git a/src/app/navigation/nav-collapse/nav-collapse.component.scss b/src/app/navigation/nav-collapse/nav-collapse.component.scss
index 8f64751a..3683fd1a 100644
--- a/src/app/navigation/nav-collapse/nav-collapse.component.scss
+++ b/src/app/navigation/nav-collapse/nav-collapse.component.scss
@@ -1,12 +1,26 @@
:host {
+ .nav-link {
+ .collapse-arrow {
+ transition: transform .3s ease-in-out, opacity .25s ease-in-out .1s;
+ transform: rotate(0);
+ }
+ }
+
> .children {
- display: none;
+ overflow: hidden;
}
&.open {
- > .children {
- display: block;
+
+ .nav-link {
+ .collapse-arrow {
+ transform: rotate(90deg);
+ }
}
+
+ > .children {
+ }
+
}
}
diff --git a/src/app/navigation/nav-collapse/nav-collapse.component.ts b/src/app/navigation/nav-collapse/nav-collapse.component.ts
index b80cf57f..7d1e6124 100644
--- a/src/app/navigation/nav-collapse/nav-collapse.component.ts
+++ b/src/app/navigation/nav-collapse/nav-collapse.component.ts
@@ -1,17 +1,19 @@
import {Component, HostBinding, Input, OnInit} from '@angular/core';
import {NavigationService} from '../navigation.service';
import {NavigationEnd, Router} from '@angular/router';
+import {Animations} from '../../core/animations';
@Component({
selector : 'fuse-nav-collapse',
templateUrl: './nav-collapse.component.html',
styleUrls : ['./nav-collapse.component.scss'],
+ animations : [Animations.slideInOut]
})
export class NavCollapseComponent implements OnInit
{
@Input() item: any;
@HostBinding('class') classes = 'nav-collapse nav-item';
- @HostBinding('class.open') private isOpen = false;
+ @HostBinding('class.open') public isOpen = false;
constructor(private navigationService: NavigationService, private router: Router)
{
@@ -75,9 +77,7 @@ export class NavCollapseComponent implements OnInit
{
ev.preventDefault();
this.isOpen = !this.isOpen;
- // this.navigationService.onNavItemClicked.emit(this.item);
this.navigationService.onNavCollapseToggled.emit(this.item);
- console.log('toggleOpen');
}
/**
@@ -133,6 +133,11 @@ export class NavCollapseComponent implements OnInit
return false;
}
+ public isCollapsed(): boolean
+ {
+ return this.isOpen;
+ }
+
ngOnInit()
{
}
diff --git a/src/app/navigation/nav-item/nav-item.component.html b/src/app/navigation/nav-item/nav-item.component.html
index 2b8ac9e2..c1e83d88 100644
--- a/src/app/navigation/nav-item/nav-item.component.html
+++ b/src/app/navigation/nav-item/nav-item.component.html
@@ -1,5 +1,5 @@
- {{item.icon}}
+ {{item.icon}}
{{item.title}}
diff --git a/src/app/navigation/navigation.component.scss b/src/app/navigation/navigation.component.scss
index b3017403..fc1e04b4 100644
--- a/src/app/navigation/navigation.component.scss
+++ b/src/app/navigation/navigation.component.scss
@@ -27,6 +27,10 @@
color: map_get($foreground, text);
cursor: pointer;
+ > span {
+ flex: 1;
+ }
+
&:hover {
background-color: map-get($background, hover);
}
@@ -42,18 +46,22 @@
background-color: mat-color($accent, default-contrast, 0.1);
}
- &, .mat-icon {
+ &, .nav-link-icon {
color: mat-color($accent, default-contrast);
}
}
- .mat-icon {
+ .nav-link-icon {
+ margin-right: 16px;
+ }
+
+ .nav-link-icon,
+ .collapse-arrow {
font-size: 16px;
width: 16px;
height: 16px;
line-height: 16px;
color: map_get($mat-light-theme-foreground, icon);;
- margin-right: 16px;
}
}