[frontend/components] Refactor AttachmentComponent

Current implementation was unable to remove the blur when opening anything other than images
This commit is contained in:
Jeder 2024-10-31 17:56:50 +01:00 committed by Lilian
parent 01a2483386
commit 2e45d74a4a
No known key found for this signature in database

View file

@ -1,10 +1,10 @@
@using Iceshrimp.Assets.PhosphorIcons
@using Iceshrimp.Shared.Schemas.Web
<div class="wrapper" @onclick="Open" @onclick:stopPropagation="true">
@if (Attachment.ContentType.StartsWith("image"))
{
<div class="wrapper" @onclick="Open" @onclick:stopPropagation="true">
<img class="attachment @(BlurImage ? "blur-image" : "")" src="@Attachment.Url" alt="@Attachment.AltText"/>
</div>
}
// else if (Attachment.ContentType == "audio/x-mod")
// {
@ -12,29 +12,24 @@
// }
else if (Attachment.ContentType.StartsWith("audio"))
{
<div class="wrapper">
<audio controls class="attachment @(BlurImage ? "blur-image" : "")" src="@Attachment.Url"></audio>
</div>
}
else if (Attachment.ContentType.StartsWith("video"))
{
<div class="wrapper">
<video controls class="attachment @(BlurImage ? "blur-image" : "")">
<source src="@Attachment.Url"/>
</video>
</div>
}
else
{
<div class="wrapper">
<span class="attachment file @(BlurImage ? "blur-image" : "")">
<Icon Name="Icons.DownloadSimple" Size="1.3em"/>
<a href="@Attachment.Url" target="_blank">
@Attachment.Url.Split("/").Last()
</a>
</span>
</div>
}
</div>
@code {
[Parameter] [EditorRequired] public required NoteAttachment Attachment { get; set; }