
Current implementation was unable to remove the blur when opening anything other than images
57 lines
No EOL
1.6 KiB
Text
57 lines
No EOL
1.6 KiB
Text
@using Iceshrimp.Assets.PhosphorIcons
|
|
@using Iceshrimp.Shared.Schemas.Web
|
|
|
|
<div class="wrapper" @onclick="Open" @onclick:stopPropagation="true">
|
|
@if (Attachment.ContentType.StartsWith("image"))
|
|
{
|
|
<img class="attachment @(BlurImage ? "blur-image" : "")" src="@Attachment.Url" alt="@Attachment.AltText"/>
|
|
}
|
|
// else if (Attachment.ContentType == "audio/x-mod")
|
|
// {
|
|
// TODO: Module player
|
|
// }
|
|
else if (Attachment.ContentType.StartsWith("audio"))
|
|
{
|
|
<audio controls class="attachment @(BlurImage ? "blur-image" : "")" src="@Attachment.Url"></audio>
|
|
}
|
|
else if (Attachment.ContentType.StartsWith("video"))
|
|
{
|
|
<video controls class="attachment @(BlurImage ? "blur-image" : "")">
|
|
<source src="@Attachment.Url"/>
|
|
</video>
|
|
}
|
|
else
|
|
{
|
|
<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>
|
|
|
|
@code {
|
|
[Parameter] [EditorRequired] public required NoteAttachment Attachment { get; set; }
|
|
[Parameter] [EditorRequired] public required EventCallback OnOpen { get; set; }
|
|
|
|
private bool BlurImage { get; set; }
|
|
|
|
private void Open()
|
|
{
|
|
if (BlurImage)
|
|
{
|
|
BlurImage = false;
|
|
StateHasChanged();
|
|
}
|
|
else
|
|
{
|
|
OnOpen.InvokeAsync();
|
|
}
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
BlurImage = Attachment.IsSensitive;
|
|
}
|
|
} |