Skip to content

Commit ff11db0

Browse files
committed
💄 add overlay in responsive design
1 parent 18f4483 commit ff11db0

File tree

11 files changed

+92
-21
lines changed

11 files changed

+92
-21
lines changed

src/app/core/components/header/header.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ export class HeaderComponent {
99
changeVisibilitySidebar(): void {
1010
const sidebarElement = document.querySelector('.sidebar') as HTMLElement;
1111
sidebarElement.classList.toggle('closed');
12+
const overlayElement = document.querySelector('.overlay') as HTMLElement;
13+
overlayElement.classList.toggle('opened');
1214
}
1315
}

src/app/core/components/sidebar/sidebar.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@
3030
</li>
3131
</ul>
3232
</nav>
33+
34+
<div class="overlay" #overlay (click)="changeVisibilitySidebar()"></div>

src/app/core/components/sidebar/sidebar.component.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,25 @@ nav {
144144
justify-content: center;
145145
}
146146
}
147+
148+
.overlay {
149+
background-color: rgba(71, 80, 87, 0.4);
150+
top: 0;
151+
right: 0;
152+
bottom: 0;
153+
left: 0;
154+
width: 100%;
155+
z-index: 99;
156+
transition: left 0.3s ease-in-out;
157+
158+
&.opened {
159+
position: fixed;
160+
opacity: 1;
161+
left: 250px;
162+
transition: left 0.3s ease-in-out;
163+
}
164+
165+
@media (min-width: 769px) {
166+
display: none;
167+
}
168+
}

src/app/core/components/sidebar/sidebar.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnDestroy, OnInit } from '@angular/core';
1+
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
22

33
import { Subscription } from 'rxjs';
44

@@ -13,6 +13,8 @@ import { FileService } from '@services/file.service';
1313
export class SidebarComponent implements OnDestroy, OnInit {
1414
userActive = this.authService.userActive;
1515
private totalSizeSubscription: Subscription;
16+
@ViewChild('overlay') overlay: ElementRef;
17+
1618
constructor(
1719
private authService: AuthService,
1820
private fileService: FileService
@@ -36,5 +38,6 @@ export class SidebarComponent implements OnDestroy, OnInit {
3638
changeVisibilitySidebar(): void {
3739
const sidebarElement = document.querySelector('.sidebar') as HTMLElement;
3840
sidebarElement.classList.toggle('closed');
41+
this.overlay.nativeElement.classList.toggle('opened');
3942
}
4043
}

src/app/features/folder/folder.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
<app-actions [folder]="folder"></app-actions>
12
<div class="fluid-container" *ngIf="!loading && folder">
2-
<app-actions [folder]="folder"></app-actions>
33
<div class="not-items" *ngIf="!allFiles.length">
44
<img src="assets/images/no-files.svg" alt="no-files-image">
55
<span class="description">Agrega tu primer archivo o carpeta</span>

src/app/features/home/home.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
<app-actions [folder]="root"></app-actions>
12
<div class="fluid-container">
2-
<app-actions [folder]="root"></app-actions>
33
<div class="not-items" *ngIf="root.folders.length < 1 && root.files.length < 1">
44
<img src="assets/images/no-files.svg" alt="no-files-image">
55
<span class="description">Agrega tu primer archivo o carpeta</span>
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
<header class="actions">
2-
<app-breadcrumb></app-breadcrumb>
3-
<div class="new">
4-
<button #btnDrop class="btn btn-primary btn-select" (click)="openDrop(btnDrop)">
5-
<span class="title">Nuevo</span>
6-
<i class="bx bx-plus"></i>
7-
</button>
8-
<ul class="list-items">
9-
<li class="item" (click)="openNewFolderModal(btnDrop)">
10-
<i class="bx bx-folder-plus"></i>
11-
<span class="title">Carpeta nueva</span>
12-
</li>
13-
<li class="item" (click)="openNewFileModal(btnDrop)">
14-
<i class="bx bx-upload"></i>
15-
<span class="title">Subir archivo</span>
16-
</li>
17-
</ul>
1+
<header>
2+
<div class="actions">
3+
<app-breadcrumb></app-breadcrumb>
4+
<div class="new">
5+
<button #btnDrop class="btn btn-primary btn-select" (click)="openDrop(btnDrop)">
6+
<span class="title">Nuevo</span>
7+
<i class="bx bx-plus"></i>
8+
</button>
9+
<ul class="list-items">
10+
<li class="item" (click)="openNewFolderModal(btnDrop)">
11+
<i class="bx bx-folder-plus"></i>
12+
<span class="title">Carpeta nueva</span>
13+
</li>
14+
<li class="item" (click)="openNewFileModal(btnDrop)">
15+
<i class="bx bx-upload"></i>
16+
<span class="title">Subir archivo</span>
17+
</li>
18+
</ul>
19+
</div>
1820
</div>
1921
</header>

src/app/shared/headers/actions/actions.component.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,26 @@
1818
display: block;
1919
}
2020

21+
header {
22+
position: fixed;
23+
background: var(--bg);
24+
z-index: 90;
25+
width: -webkit-fill-available;
26+
height: 60px;
27+
box-shadow: rgba(0, 0, 0, 0.05) 0px 17px 24px 0px, rgba(0, 0, 0, 0.08) 0px 1px 0px 1px;
28+
29+
@include width-medium {
30+
height: 55px;
31+
}
32+
}
33+
2134
.actions {
2235
display: flex;
2336
align-items: center;
2437
justify-content: space-between;
2538
gap: 1rem;
39+
padding: 0.6rem 1rem;
40+
height: 100%;
2641
}
2742

2843
.list-items {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.modal-content {
2+
max-width: 30rem;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.modal-content {
2+
max-width: 30rem;
3+
}

0 commit comments

Comments
 (0)