45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
@inject IJSRuntime JS
|
|
@inject ISnackbar Snackbar
|
|
|
|
<MudDialog>
|
|
<TitleContent>
|
|
<MudText Typo="Typo.h6">Поделиться плейлистом</MudText>
|
|
</TitleContent>
|
|
<DialogContent>
|
|
<MudStack Spacing="2">
|
|
<MudText>Скопируйте ссылку и отправьте её друзьям:</MudText>
|
|
<MudTextField @bind-Value="ShareUrl"
|
|
Variant="Variant.Outlined"
|
|
ReadOnly="true"
|
|
Margin="Margin.Dense"
|
|
Class="mt-2" />
|
|
</MudStack>
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary"
|
|
OnClick="CopyToClipboard">
|
|
Скопировать ссылку
|
|
</MudButton>
|
|
<MudButton Variant="Variant.Text" Color="Color.Default"
|
|
OnClick="Close">
|
|
Закрыть
|
|
</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code {
|
|
[CascadingParameter]
|
|
private IMudDialogInstance MudDialog { get; set; } = default!;
|
|
|
|
[Parameter]
|
|
public string ShareUrl { get; set; } = string.Empty;
|
|
|
|
private async Task CopyToClipboard()
|
|
{
|
|
await JS.InvokeVoidAsync("navigator.clipboard.writeText", ShareUrl);
|
|
Snackbar.Add("Ссылка скопирована в буфер обмена!", Severity.Success);
|
|
MudDialog.Close(DialogResult.Ok(true));
|
|
}
|
|
|
|
private void Close() => MudDialog.Cancel();
|
|
} |