Skip to content

Commit

Permalink
feat(app): update design to inform user of smaller screen about compa…
Browse files Browse the repository at this point in the history
…tible device
  • Loading branch information
Mathieu Hermann committed Nov 14, 2024
1 parent af72b5c commit 85e22ea
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
<router-outlet />
@if(!screenCompatible()) {
<app-notification>
Your screen height is incompatible with Retroski. Please switch to portrait
mode or use a device with a screen height of at least 500 pixels.
</app-notification>
}
5 changes: 5 additions & 0 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
max-height: 100%;
border-radius: var(--border-radius);
background-color: var(--color-surface);

app-notification {
position: absolute;
top: 10dvh;
}
}
12 changes: 10 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { Component, Signal, signal } from '@angular/core';
import { Component, Signal, signal, WritableSignal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { NotificationComponent } from "./common/components/notification/notification.component";

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
imports: [RouterOutlet, NotificationComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.scss'
})
export class AppComponent {
protected screenCompatible: WritableSignal<boolean>;

constructor() {
this.screenCompatible = signal(screen.height >= 500);

addEventListener('resize', () => this.screenCompatible.set(screen.height >= 500));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<ng-content></ng-content>
10 changes: 10 additions & 0 deletions src/app/common/components/notification/notification.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:host {
display: block;
max-width: 75dvw;
padding: 1rem;
border-radius: var(--border-radius-large);
background-color: var(--color-error-lightest);
color: var(--color-error-darkest);

font-size: var(--text-small);
}
13 changes: 13 additions & 0 deletions src/app/common/components/notification/notification.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ChangeDetectionStrategy, Component, input, signal } from '@angular/core';

@Component({
selector: 'app-notification',
standalone: true,
imports: [],
templateUrl: './notification.component.html',
styleUrl: './notification.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class NotificationComponent {

}
3 changes: 2 additions & 1 deletion src/app/pages/home/home.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
padding: 1rem;

.logo {
margin: 5dvh 0;
margin: 3dvh 0;
width: 170px;
height: 170px;
}
Expand All @@ -22,6 +22,7 @@
color: var(--color-tertiary-light);
text-align: center;
max-width: var(--field-max-width);
padding-bottom: 1rem;
}

.actions-container {
Expand Down

0 comments on commit 85e22ea

Please sign in to comment.