Created some request models. Started building create star form together
This commit is contained in:
38
MoonlightServers.Frontend/UI/Components/Forms/Switch.razor
Normal file
38
MoonlightServers.Frontend/UI/Components/Forms/Switch.razor
Normal file
@@ -0,0 +1,38 @@
|
||||
@using System.Diagnostics.CodeAnalysis
|
||||
@using Microsoft.AspNetCore.Components
|
||||
|
||||
@* TODO: Extract to mooncore? *@
|
||||
|
||||
@inherits InputBase<bool>
|
||||
|
||||
<div class="flex items-center">
|
||||
<div class="form-switch">
|
||||
<input @bind="CurrentValue" type="checkbox" id="@("switch-" + GetHashCode())" class="sr-only">
|
||||
<label class="bg-gray-700" for="switch-@(GetHashCode())">
|
||||
<span class="bg-white shadow-sm" aria-hidden="true"></span>
|
||||
<span class="sr-only">Switch label</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="text-sm text-gray-500 italic ml-2">
|
||||
@if (CurrentValue)
|
||||
{
|
||||
<span>On</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>
|
||||
Off
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
protected override bool TryParseValueFromString(string? value, out bool result, [NotNullWhen(false)] out string? validationErrorMessage)
|
||||
{
|
||||
validationErrorMessage = null;
|
||||
result = string.Equals(value, "true", StringComparison.OrdinalIgnoreCase);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user