mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-16 06:13:48 +00:00
Refactored & added the text info line component
This commit is contained in:
4 files changed
+53
-70
No files matched your search
@@ -0,0 +1,18 @@
|
||||
<MudStack Row="@true" AlignItems="AlignItems.Center">
|
||||
<MudTextField
|
||||
T="string"
|
||||
ReadOnly="@true"
|
||||
Label="@this.Label"
|
||||
Text="@this.Value"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@this.Icon"/>
|
||||
|
||||
@if (this.ShowingCopyButton)
|
||||
{
|
||||
<MudTooltip Text="@this.ClipboardTooltip">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" Size="Size.Medium" OnClick="@(() => this.CopyToClipboard(this.Value))"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
</MudStack>
|
||||
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Components;
|
||||
|
||||
public partial class TextInfoLine : ComponentBase
|
||||
{
|
||||
[Parameter]
|
||||
public string Label { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public string Icon { get; set; } = Icons.Material.Filled.Info;
|
||||
|
||||
[Parameter]
|
||||
public string Value { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public string ClipboardTooltipSubject { get; set; } = "the text";
|
||||
|
||||
[Parameter]
|
||||
public bool ShowingCopyButton { get; set; } = true;
|
||||
|
||||
[Inject]
|
||||
private RustService RustService { get; init; } = null!;
|
||||
|
||||
[Inject]
|
||||
private ISnackbar Snackbar { get; init; } = null!;
|
||||
|
||||
private string ClipboardTooltip => $"Copy {this.ClipboardTooltipSubject} to the clipboard";
|
||||
|
||||
private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(this.Snackbar, content);
|
||||
}
|
||||
Reference in new issue
Block a user