I18NCommander/I18N Commander/UI MAUI/Components/Assistant.razor.cs

32 lines
1.1 KiB
C#
Raw Permalink Normal View History

2022-08-12 21:56:30 +00:00
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);
}