Skip to content

Commit 59deb81

Browse files
cleaned up
1 parent 76364a3 commit 59deb81

File tree

5 files changed

+30
-60
lines changed

5 files changed

+30
-60
lines changed

src/app/app.component.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
@import "src/assets/scss/setup/variables";
33

44
#content {
5-
transition: margin-left 0.3s ease;
6-
75
@media (min-width: $screen-md-min) {
86
padding-left: 0;
9-
7+
transition: padding-left 0.3s ease-in-out;
108
&.nav-visible {
119
padding-left: $navWidth;
1210
}

src/app/app.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import { LoggedInService } from "@shared/services/loggedin.service";
99
export class AppComponent {
1010
title = "OS2IoT-frontend";
1111
isLoggedIn = true;
12-
13-
isNavVisible = false;
12+
isNavVisible = true;
1413

1514
onNavToggle(isVisible: boolean) {
1615
this.isNavVisible = isVisible;

src/app/navbar/navbar.component.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<nav
2-
class="navbar navbar-expand-md navbar-light d-md-flex align-items-md-start flex-md-column p-3"
2+
class="navbar-container navbar navbar-expand-md navbar-light d-md-flex align-items-md-start flex-md-column p-3"
33
aria-expanded="false"
4-
*ngIf="isVisible"
5-
[@navAnimation]
4+
[class.nav-visible]="isVisible"
65
>
76
<img class="img-logo" alt="OS2IoT-logo" [src]="imagePath" />
87

@@ -140,13 +139,8 @@
140139
</ul>
141140
</div>
142141
</ng-template>
143-
<div class="toggle-button hide-button" (click)="toggleNavbar()">
144-
<mat-icon class="icon-arrow-nav" svgIcon="nav-arrow"></mat-icon>
145-
</div>
146142
</nav>
147143

148-
@if(!isVisible){
149-
<div class="toggle-button show-button" (click)="toggleNavbar()">
144+
<div [class.nav-visible-button]="isVisible" class="toggle-button" (click)="toggleNavbar()">
150145
<mat-icon class="icon-arrow-nav rotate" svgIcon="nav-arrow"></mat-icon>
151146
</div>
152-
}

src/app/navbar/navbar.component.scss

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,19 @@ button:focus,
116116
}
117117
}
118118

119-
.hide-button {
120-
right: 0px;
121-
padding-left: 2px;
122-
border-radius: 5px 0 0 5px;
123-
}
124-
125-
.show-button {
126-
border-radius: 0 5px 5px 0;
127-
padding-right: 2px;
128-
}
129-
130119
.toggle-button {
131120
top: 50%;
132121
position: absolute;
133122
width: 18px;
134123
height: 40px;
124+
left: 0px;
135125
display: flex;
136126
align-items: center;
137127
justify-content: center;
138128
background-color: $color-neutral-200;
129+
padding: 0 2px 0 0;
130+
border-radius: 0 5px 5px 0;
131+
transition: left 0.3s ease-in-out, border-radius 0.3s ease-in-out;
139132

140133
&:hover {
141134
background-color: $color-link-active-bg;
@@ -144,24 +137,40 @@ button:focus,
144137
&:hover .icon-arrow-nav {
145138
color: $white;
146139
}
147-
}
148140

149-
.rotate {
150-
transform: rotate(180deg);
141+
&.nav-visible-button {
142+
border-radius: 5px 0 0 5px;
143+
left: 248px;
144+
padding: 0 0 0 2px;
145+
.icon-arrow-nav {
146+
transform: rotate(0deg);
147+
}
148+
}
151149
}
152150

153151
.icon-arrow-nav {
154152
color: $default-color;
155153
height: 40px;
156154
width: 10px;
155+
transform: rotate(180deg);
157156
}
158157

159158
@media (max-width: 768px) {
160159
.icon-arrow-nav,
161160
.toggle-button,
162161
.show-button,
163-
.hide-button,
164-
.rotate {
162+
.hide-button {
165163
display: none;
166164
}
167165
}
166+
167+
.navbar-container {
168+
transform: translateX(-100%);
169+
opacity: 0;
170+
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
171+
172+
&.nav-visible {
173+
transform: translateX(0);
174+
opacity: 1;
175+
}
176+
}

src/app/navbar/navbar.component.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { animate, state, style, transition, trigger } from "@angular/animations";
21
import { Component, EventEmitter, OnInit, Output } from "@angular/core";
32
import { MatIconRegistry } from "@angular/material/icon";
43
import { DomSanitizer } from "@angular/platform-browser";
@@ -20,35 +19,6 @@ import { UserResponse } from "./../admin/users/user.model";
2019
selector: "app-navbar",
2120
templateUrl: "./navbar.component.html",
2221
styleUrls: ["./navbar.component.scss"],
23-
animations: [
24-
trigger("navAnimation", [
25-
state(
26-
"void",
27-
style({
28-
transform: "translateX(-100%)",
29-
opacity: 0,
30-
})
31-
),
32-
transition(":enter", [
33-
animate(
34-
"0.3s ease-out",
35-
style({
36-
transform: "translateX(0)",
37-
opacity: 1,
38-
})
39-
),
40-
]),
41-
transition(":leave", [
42-
animate(
43-
"0.3s ease-in",
44-
style({
45-
transform: "translateX(-100%)",
46-
opacity: 0,
47-
})
48-
),
49-
]),
50-
]),
51-
],
5222
})
5323
export class NavbarComponent implements OnInit {
5424
public organisations: Organisation[];

0 commit comments

Comments
 (0)