Prevent header layout shift

pull/6752/head
Chocobozzz 2024-12-02 08:41:05 +01:00
parent 3172bd1de7
commit c904f8fbfe
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 10 additions and 11 deletions

View File

@ -1,13 +1,13 @@
<div class="root" [hidden]="!loaded || (loggedIn && !user.account)">
<div class="root">
<a class="peertube-title" [routerLink]="getDefaultRoute()" [queryParams]="getDefaultRouteQuery()">
<span class="icon-logo"></span>
<span class="instance-name">{{ instanceName }}</span>
</a>
<my-search-typeahead></my-search-typeahead>
<my-search-typeahead [hidden]="!isLoaded()"></my-search-typeahead>
<div class="d-flex align-items-center buttons-container">
<div class="d-flex align-items-center buttons-container" [hidden]="!isLoaded()">
@if (!loggedIn) {
<my-button
i18n-title title="Open settings modal"

View File

@ -25,6 +25,7 @@
color: inherit !important;
display: flex;
align-items: center;
min-height: 46px; // Prevent layout shifting when waiting for the right part of the header to load
@include padding-left(18px);
@include margin-right(0.5rem);

View File

@ -62,8 +62,6 @@ export class HeaderComponent implements OnInit, OnDestroy {
currentInterfaceLanguage: string
loaded = false
private serverConfig: ServerConfig
private quickSettingsModalSub: Subscription
@ -93,6 +91,10 @@ export class HeaderComponent implements OnInit, OnDestroy {
return this.serverService.getHTMLConfig().instance.name
}
isLoaded () {
return this.serverConfig && (!this.loggedIn || !!this.user?.account)
}
isInMobileView () {
return this.screenService.isInMobileView()
}
@ -125,8 +127,6 @@ export class HeaderComponent implements OnInit, OnDestroy {
this.quickSettingsModalSub = this.modalService.openQuickSettingsSubject
.subscribe(() => this.openQuickSettings())
this.loaded = true
}
ngOnDestroy () {

View File

@ -205,12 +205,10 @@
@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px, $right: 0) {
my-global-icon {
position: relative;
display: inline-block;
width: $width;
height: $width;
line-height: $width;
top: $top;
right: $right;
@include global-icon-size($width);
}
&:not(.icon-only) {