Enhance main navbar styles for better overflow handling and safe area support

This commit is contained in:
Vincent Guillet
2025-12-03 21:49:52 +01:00
parent 00f45ae6c7
commit e04cac3345

View File

@@ -1,3 +1,16 @@
/* src/app/components/main-navbar/main-navbar.component.css */
/* Ajout prise en charge safe-area et meilleure gestion des overflow */
.mat-toolbar {
/* protège contre les zones sensibles (notch / status bar) */
padding-top: constant(safe-area-inset-top);
padding-top: env(safe-area-inset-top);
position: relative;
z-index: 1000;
box-sizing: border-box;
}
/* wrapper principal */
.container { .container {
max-width: 1200px; max-width: 1200px;
margin: 0 auto; margin: 0 auto;
@@ -8,19 +21,22 @@
gap: 12px; gap: 12px;
padding: 0 12px; padding: 0 12px;
box-sizing: border-box; box-sizing: border-box;
min-height: 56px; /* assure une hauteur minimale utile sur mobile */
} }
/* marque / titre */
.brand { .brand {
font-weight: bold; font-weight: bold;
font-size: 1.2rem; font-size: 1.2rem;
cursor: pointer; cursor: pointer;
min-width: 0; min-width: 0; /* autorise le shrink */
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
flex: 1 1 auto; flex: 1 1 auto;
} }
/* actions (boutons, menu utilisateur) */
.nav-actions { .nav-actions {
display: flex; display: flex;
gap: 0.5rem; gap: 0.5rem;
@@ -28,13 +44,43 @@
flex: 0 1 auto; flex: 0 1 auto;
justify-content: flex-end; justify-content: flex-end;
flex-wrap: nowrap; flex-wrap: nowrap;
min-width: 0; /* important pour permettre la réduction des enfants */
overflow: visible;
} }
/* icône dans mat-menu */
.mat-menu-item mat-icon { .mat-menu-item mat-icon {
margin-right: 8px; margin-right: 8px;
} }
/* Empêcher les boutons de dépasser et couper le texte avec ellipsis */
.nav-actions button {
min-width: 0;
max-width: 100%;
display: inline-flex;
align-items: center;
gap: 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Angular Material place le texte dans .mat-button-wrapper — on le tronque proprement */
.nav-actions button .mat-button-wrapper {
display: inline-block;
max-width: calc(100% - 56px); /* espace pour icônes + padding */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
/* Ajustements spécifiques pour petits écrans */
@media (max-width: 720px) { @media (max-width: 720px) {
.mat-toolbar {
padding-top: env(safe-area-inset-top);
}
.container { .container {
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
@@ -55,6 +101,7 @@
gap: 8px; gap: 8px;
overflow-x: auto; overflow-x: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
padding-bottom: 4px; /* espace pour le scroll horizontal */
} }
.nav-actions button { .nav-actions button {
@@ -62,6 +109,11 @@
font-size: 0.95rem; font-size: 0.95rem;
min-width: 0; min-width: 0;
white-space: nowrap; white-space: nowrap;
max-width: 100%;
}
.nav-actions button .mat-button-wrapper {
max-width: calc(100% - 40px);
} }
.nav-actions mat-icon { .nav-actions mat-icon {