VideoStudy/VideoStudy.UI/Components/YouTubeProcessor.razor
2026-05-15 21:18:55 -03:00

38 lines
1.2 KiB
Plaintext

@using VideoStudy.Shared
<div class="processor-card p-2">
<div class="mb-3">
<label class="form-label fw-bold text-muted small">URL do YouTube</label>
<input type="text" class="form-control form-control-lg"
placeholder="https://www.youtube.com/watch?v=..."
@bind="VideoUrl" @bind:event="oninput"
@onchange="OnUrlChanged"
disabled="@IsProcessing" />
</div>
@if (VideoInfo != null)
{
<div class="p-3 bg-light rounded-3">
<div class="fw-bold">@VideoInfo.Title</div>
<div class="d-flex gap-3 text-muted small mt-1">
<span>@VideoInfo.Author</span>
<span>@VideoInfo.Duration.ToString(@"hh\:mm\:ss")</span>
</div>
</div>
}
</div>
@code {
[Parameter] public EventCallback<string> OnVideoUrlChanged { get; set; }
[Parameter] public bool IsProcessing { get; set; }
[Parameter] public VideoInfo? VideoInfo { get; set; }
private string VideoUrl { get; set; } = "";
private async Task OnUrlChanged(ChangeEventArgs e)
{
VideoUrl = e.Value?.ToString() ?? "";
await OnVideoUrlChanged.InvokeAsync(VideoUrl);
}
}