Замена div на компоненты

This commit is contained in:
FrigaT
2026-04-15 09:52:56 +03:00
parent abf1906173
commit c7bd97462a
5 changed files with 60 additions and 76 deletions

View File

@@ -1,29 +1,24 @@
@using Microsoft.AspNetCore.Components.Web
@inject IAudioPlayerService AudioPlayerService
<div class="track-cover-container"
@onmouseenter="HandleMouseEnter"
@onmouseleave="HandleMouseLeave"
style="position: relative; display: inline-block; cursor: pointer;">
<MudPaper Elevation="0"
@onmouseenter="HandleMouseEnter"
@onmouseleave="HandleMouseLeave"
style="position: relative; display: inline-block; cursor: pointer; border-radius: 4px; overflow: hidden;">
<MudImage Src="@CoverUrl.FormatCoverUrl(Width, Height)" Height="@Height" Width="@Width" Class="rounded" Style="display: block;" />
@if (_isHovered || IsCurrentTrackPlaying)
{
<div class="play-overlay"
style="position: absolute; top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.6);
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;">
<MudPaper class="play-overlay"
style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; border-radius: 4px;">
<MudIconButton Icon="@(IsCurrentTrackPlaying? Icons.Material.Filled.Pause : Icons.Material.Filled.PlayArrow)"
Color="Color.Inherit"
Size="Size.Large"
OnClick="OnPlayClick" />
</div>
</MudPaper>
}
</div>
</MudPaper>
@code {
[Parameter] public string CoverUrl { get; set; } = string.Empty;
@@ -56,9 +51,9 @@
else
{
await AudioPlayerService.LoadAndPlayAsync(
trackId: TrackId,
playlistShareToken: playlistShareToken,
title: TrackTitle,
trackId: TrackId,
playlistShareToken: playlistShareToken,
title: TrackTitle,
coverUrl: CoverUrl);
}
}