BlazorStart/Start/Client/Components/CreateContainer.razor
2021-12-05 15:50:48 -08:00

70 lines
2.5 KiB
Plaintext

@using Start.Client.Store.Features.CreateContainer
@using Fluxor
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
@inject IDispatcher dispatch
@inject IState<CreateContainerState> state
<Dialog Title="Create Container" Active="this.state.Value.ShowCreateContainerForm" OnClose="this.OnDialogClose">
<EditForm Model="this.Model" OnValidSubmit="this.OnSubmit">
@if (this.state.Value.CreateContainerErrorMessage != null)
{
<Alert Type="Alert.AlertType.Error">
@this.state.Value.CreateContainerErrorMessage
</Alert>
}
<div class="form-group">
<div class="container">
<div class="columns">
<div class="column col-12">
<div>
<label for="createBookmarkContainerTitle" class="form-label">Title</label>
<InputText id="createBookmarkContainerTitle" name="createBookmarkContainerTitle"
class="form-input" @bind-Value="this.Model.Title" />
</div>
</div>
</div>
</div>
<div class="container">
<div class="columns">
<div class="column col-12 text-right">
<div>
@if (this.state.Value.IsLoadingCreateContainer)
{
<button type="submit" disabled class="btn btn-primary loading">
<i class="icon icon-plus"></i> Create
</button>
}
else
{
<button type="submit" class="btn btn-primary">
<i class="icon icon-plus"></i> Create
</button>
}
</div>
</div>
</div>
</div>
</div>
</EditForm>
</Dialog>
@code {
[Parameter]
public EventCallback<BookmarkContainerDto> OnCreated { get; set; }
private BookmarkContainerDto Model { get; set; } = new BookmarkContainerDto("");
protected void OnSubmit()
{
dispatch.Dispatch(new SubmitCreateContainerAction(this.Model));
}
protected void OnDialogClose()
{
dispatch.Dispatch(new HideCreateContainerFormAction());
}
}