Fix home padding

Signed-off-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
Chocobozzz 2024-11-27 10:24:11 +01:00
parent 3eb1f23977
commit a1ad7035db
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
7 changed files with 4 additions and 34 deletions

View File

@ -1,10 +1,2 @@
@use '_variables' as *;
@use '_mixins' as *;
.margin-content {
padding-top: 2rem;
::ng-deep .revert-home-padding-top {
margin-top: -2rem;
}
}

View File

@ -1,17 +1,16 @@
import { ComponentRef, Injectable } from '@angular/core'
import { MarkdownService } from '@app/core'
import { logger } from '@root-helpers/logger'
import {
ButtonMarkupData,
ChannelMiniatureMarkupData,
ContainerMarkupData,
EmbedMarkupData,
InstanceAvatarMarkupData,
InstanceBannerMarkupData,
PlaylistMiniatureMarkupData,
VideoMiniatureMarkupData,
VideosListMarkupData
} from '@peertube/peertube-models'
import { logger } from '@root-helpers/logger'
import { DynamicElementService } from './dynamic-element.service'
import {
ButtonMarkupComponent,
@ -162,15 +161,8 @@ export class CustomMarkupService {
}
private instanceBannerBuilder (el: HTMLElement) {
const data = el.dataset as InstanceBannerMarkupData
const { component, loadedPromise } = this.dynamicElementService.createElement(InstanceBannerMarkupComponent)
const model = {
revertHomePaddingTop: this.buildBoolean(data.revertHomePaddingTop) ?? true
}
this.dynamicElementService.setModel(component, model)
return { component, loadedPromise }
}

View File

@ -1,3 +1,3 @@
<div class="banner revert-margin-content" [ngClass]="{ 'revert-home-padding-top': revertHomePaddingTop }" *ngIf="instanceBannerUrl">
<div class="banner" *ngIf="instanceBannerUrl">
<img [src]="instanceBannerUrl" alt="Instance banner">
</div>

View File

@ -1,4 +1,4 @@
import { NgClass, NgIf } from '@angular/common'
import { NgIf } from '@angular/common'
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core'
import { ServerService } from '@app/core'
import { maxBy } from '@peertube/peertube-core-utils'
@ -13,11 +13,9 @@ import { CustomMarkupComponent } from './shared'
templateUrl: 'instance-banner-markup.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [ NgIf, NgClass ]
imports: [ NgIf ]
})
export class InstanceBannerMarkupComponent implements OnInit, CustomMarkupComponent {
@Input() revertHomePaddingTop: boolean
instanceBannerUrl: string
loaded: undefined

View File

@ -238,10 +238,6 @@ a {
flex-grow: 1;
}
.revert-margin-content {
margin: 0 calc(#{pvar(--x-margin-content)} * -1);
}
.skip-to-content-sub-menu {
display: block;
z-index: z(modal);

View File

@ -9,10 +9,6 @@
}
}
.revert-margin-content.banner {
width: calc(100% + 2 * #{pvar(--x-margin-content)});
}
.pt-icon {
@include icon(24px);
}

View File

@ -59,10 +59,6 @@ export type ContainerMarkupData = {
justifyContent?: 'space-between' | 'normal' // default to 'space-between'
}
export type InstanceBannerMarkupData = {
revertHomePaddingTop?: StringBoolean // default to 'true'
}
export type InstanceAvatarMarkupData = {
size: string // size in pixels
}