BlazorStart/Start/Client/Components/Bookmark.razor

42 lines
1 KiB
Plaintext
Raw Permalink Normal View History

2021-12-16 18:46:22 +00:00
@using Start.Client.Store.State
@using Start.Client.Store.Features.DeleteBookmark
@using Fluxor
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
@inject IDispatcher dispatch
@inject IState<RootState> state
<li class="bookmark">
2021-12-05 23:50:48 +00:00
@if (!String.IsNullOrEmpty(this.Model.Notes))
{
2021-12-16 18:46:22 +00:00
<details class="bookmarkDetails">
2021-12-05 23:50:48 +00:00
<summary>
<a href="@this.Model.Url" class="bookmarkLink">@this.Model.Title</a>
</summary>
2021-12-16 18:46:22 +00:00
<pre>@this.Model.Notes</pre>
2021-12-05 23:50:48 +00:00
</details>
}
else
{
2021-12-16 18:46:22 +00:00
<a href="@this.Model.Url" class="bookmarkLink bookmarkDetails">@this.Model.Title</a>
}
@if (this.state.Value.EditMode)
{
<button class="btn btn-link text-error" @onclick="this.OnDeleteBookmarkClick">
<i class="icon icon-delete"></i>
</button>
2021-12-05 23:50:48 +00:00
}
</li>
@code {
[Parameter]
public BookmarkDto Model { get; set; } = null!;
2021-12-16 18:46:22 +00:00
public void OnDeleteBookmarkClick()
{
this.dispatch.Dispatch(new ShowDeleteBookmarkFormAction(this.Model));
}
2021-12-05 23:50:48 +00:00
}