diff --git a/I18N Commander/UI MAUI/Components/Assistant.razor b/I18N Commander/UI MAUI/Components/Assistant.razor new file mode 100644 index 0000000..c2439f9 --- /dev/null +++ b/I18N Commander/UI MAUI/Components/Assistant.razor @@ -0,0 +1,17 @@ +
+
+

+ @if (this.IsIconAvailable) + { + + } + @this.HeaderText +

+ +
+
+ @this.ChildContent +
+
\ No newline at end of file diff --git a/I18N Commander/UI MAUI/Components/Assistant.razor.cs b/I18N Commander/UI MAUI/Components/Assistant.razor.cs new file mode 100644 index 0000000..1980ea1 --- /dev/null +++ b/I18N Commander/UI MAUI/Components/Assistant.razor.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Components; + +namespace UI_MAUI.Components; + +public partial class Assistant : ComponentBase +{ + [Parameter] + public string HeaderText { get; set; } = string.Empty; + + [Parameter] + public string Name { get; set; } = "Assistant"; + + [Parameter] + public string IconName { get; set; } = string.Empty; + + [Parameter] + public Height BaseHeight { get; set; } = new(60, 40, 50); + + public readonly record struct Height(int Phone, int Desktop, int Tablet); + + [Parameter] + public RenderFragment ChildContent { get; set; } + + private string AssistantHeight => + DeviceInfo.Idiom == DeviceIdiom.Phone ? $"--bs-offcanvas-height: {this.BaseHeight.Phone}vh;" : + DeviceInfo.Idiom == DeviceIdiom.Tablet ? $"--bs-offcanvas-height: {this.BaseHeight.Tablet}vh;" : + $"--bs-offcanvas-height: {this.BaseHeight.Desktop}vh;"; + + private string HeaderIconAltText => $"Icon: {this.HeaderText}"; + + private bool IsIconAvailable => !string.IsNullOrWhiteSpace(this.IconName); +} \ No newline at end of file