MOBILE-3814 menu: Fix badges overflow and resize menu to 56px on tablet

main
Pau Ferrer Ocaña 2022-03-02 12:28:54 +01:00
parent 4c1e277e41
commit df1f910ee2
2 changed files with 152 additions and 134 deletions

View File

@ -1,161 +1,178 @@
@import "~theme/globals"; @import "~theme/globals";
:host{ :host {
--menutabbar-size: var(--bottom-tabs-size); ion-tabs {
--menutabbar-size: var(--bottom-tabs-size);
ion-tab-bar {
height: var(--menutabbar-size);
}
@if ($core-always-show-main-menu) {
ion-tabs.placement-bottom ion-tab-bar {
height: var(--menutabbar-size) !important;
visibility: visible !important;
transform: translateY(0) !important;
}
} @else {
ion-tabs.tabshidden.placement-bottom ion-tab-bar {
pointer-events: none;
ion-tab-button {
height: auto;
}
}
}
ion-tab-button ion-icon.core-tab-icon {
text-overflow: unset;
overflow: visible;
text-align: center;
}
ion-tab-button.ios ion-icon.core-tab-icon {
font-size: 25px;
}
ion-tab-button.md ion-badge.core-tab-badge {
font-size: 12px;
font-weight: bold;
border-radius: 10px;
padding-left: 6px;
padding-right: 6px;
line-height: 14px;
}
ion-tab-button.tab-selected {
background: var(--background-selected);
}
ion-icon.core-tab-badge {
color: var(--core-bottom-tabs-badge-color);
padding: 3px 6px 2px;
@include position(8px, null, null, calc(50% + 6px));
min-width: 12px;
font-size: 8px;
font-weight: normal;
box-sizing: border-box;
position: absolute;
z-index: 1;
}
ion-badge.core-tab-badge {
--background: var(--core-bottom-tabs-badge-color);
--color: var(--core-bottom-tabs-badge-text-color);
}
ion-tabs.placement-bottom ion-tab-button {
ion-icon.core-tab-icon {
transition: margin 500ms ease-in-out, transform 300ms ease-in-out;
}
ion-icon.core-tab-badge,
ion-badge.core-tab-badge {
top: 8px;
}
} }
ion-tabs.placement-side { ion-tabs.placement-side {
flex-direction: row; --menutabbar-size: var(--side-tabs-size);
ion-tab-bar {
order: -1;
width: var(--menutabbar-size);
height: calc(100% - var(--ion-safe-area-top) - var(--ion-safe-area-bottom));
flex-direction: column;
@include border-end(var(--border));
border-top: 0;
justify-content: flex-start;
@include padding(var(--ion-safe-area-top), 0px, var(--ion-safe-area-bottom), var(--ion-safe-area-left));
ion-tab-button, core-user-menu-button {
width: 100%;
min-height: var(--menutabbar-size);
flex: 0;
ion-icon.core-tab-badge,
ion-badge.core-tab-badge {
top: calc(50% - 20px);
}
}
}
} }
--network-margin-bottom: 0px;
--network-message-background: transparent;
--network-message-offline: none;
--network-message-online: none;
--network-message-height: 16px;
}
:host-context(.core-online),
:host-context(.core-offline) {
.core-network-message {
visibility: visible;
height: var(--network-message-height);
padding-bottom: calc(var(--ion-safe-area-bottom, 0px) + var(--network-message-height));
}
}
:host-context(.core-online) {
--network-margin-bottom: 8px;
--network-message-background: var(--success);
--network-message-online: block;
}
:host-context(.core-offline) {
--network-margin-bottom: 8px;
--network-message-background: var(--danger);
--network-message-offline: block;
}
ion-tab-bar {
height: var(--menutabbar-size);
core-user-menu-button { core-user-menu-button {
align-items: center; align-items: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.core-network-message { ion-tab-button {
--network-message-height: 16px; &.tab-selected {
position: absolute; background: var(--background-selected);
bottom: 0; }
left: 0;
right: 0;
padding-left: 10px;
padding-right: 10px;
text-align: center;
color: white;
visibility: hidden;
height: 0;
transition: all 500ms ease-in-out;
opacity: .8;
z-index: 12;
}
.core-online-message, ion-icon.core-tab-icon {
.core-offline-message { text-overflow: unset;
display: none; overflow: visible;
text-align: center;
font-size: 24px;
}
ion-badge.core-tab-badge {
font-size: 12px;
font-weight: bold;
border-radius: 10px;
padding-left: 6px;
padding-right: 6px;
line-height: 14px;
--background: var(--core-bottom-tabs-badge-color);
--color: var(--core-bottom-tabs-badge-text-color);
}
ion-icon.core-tab-badge {
color: var(--core-bottom-tabs-badge-color);
padding: 3px 6px 2px;
@include position(8px, null, null, calc(50% + 6px));
min-width: 12px;
font-size: 8px;
font-weight: normal;
box-sizing: border-box;
position: absolute;
z-index: 1;
}
} }
} }
:host-context(.core-online), ion-tabs.placement-bottom {
:host-context(.core-offline) { ion-tab-button {
ion-tabs.placement-bottom ion-tab-button ion-icon.core-tab-icon { ion-icon.core-tab-icon {
margin-bottom: 8px; margin-bottom: var(--network-margin-bottom);
transition: margin 500ms ease-in-out, transform 300ms ease-in-out;
}
ion-icon.core-tab-badge,
ion-badge.core-tab-badge {
top: 8px;
}
} }
ion-tabs.placement-bottom ion-tab-button.ios ion-icon.core-tab-icon { @if ($core-always-show-main-menu) {
margin-bottom: 14px; ion-tab-bar {
} height: var(--menutabbar-size) !important;
visibility: visible !important;
transform: translateY(0) !important;
}
} @else {
&.tabshidden ion-tab-bar {
pointer-events: none;
.core-network-message { ion-tab-button {
visibility: visible; height: auto;
height: var(--network-message-height); }
padding-bottom: calc(var(--ion-safe-area-bottom, 0px) + var(--network-message-height)); }
pointer-events: none;
} }
} }
:host-context(.core-offline) .core-offline-message, ion-tabs.placement-side {
:host-context(.core-online) .core-online-message { flex-direction: row;
display: block;
ion-tab-bar {
order: -1;
width: var(--menutabbar-size);
height: calc(100% - var(--ion-safe-area-top) - var(--ion-safe-area-bottom));
flex-direction: column;
@include border-end(var(--border));
border-top: 0;
justify-content: flex-start;
@include padding(var(--ion-safe-area-top), 0px, var(--ion-safe-area-bottom), var(--ion-safe-area-left));
ion-tab-button {
--padding-start: 0;
--padding-end: 0;
ion-badge.core-tab-badge {
@include position(null, 1px, null, auto);
}
}
ion-tab-button, core-user-menu-button {
width: 100%;
min-height: var(--menutabbar-size);
flex: 0;
ion-icon.core-tab-badge,
ion-badge.core-tab-badge {
top: calc(50% - 20px);
}
}
}
} }
:host-context(.core-online) .core-network-message { .core-network-message {
background: var(--success); background: var(--network-message-background);
} pointer-events: none;
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding-left: 10px;
padding-right: 10px;
text-align: center;
color: white;
visibility: hidden;
height: 0;
transition: all 500ms ease-in-out;
opacity: .8;
z-index: 12;
:host-context(.core-offline) .core-network-message { .core-online {
background: var(--danger); display: var(--network-message-online);
}
.core-offline {
display: var(--network-message-offline);
}
} }

View File

@ -117,6 +117,7 @@
--core-bottom-tabs-badge-color: var(--brand); --core-bottom-tabs-badge-color: var(--brand);
--core-bottom-tabs-badge-text-color: var(--brand-contrast); --core-bottom-tabs-badge-text-color: var(--brand-contrast);
--bottom-tabs-size: 48px; --bottom-tabs-size: 48px;
--side-tabs-size: 56px;
ion-tab-bar.mainmenu-tabs { ion-tab-bar.mainmenu-tabs {
--background: var(--core-bottom-tabs-background); --background: var(--core-bottom-tabs-background);
--color: var(--core-bottom-tabs-color); --color: var(--core-bottom-tabs-color);