Create component for to-do list.
This commit is contained in:
parent
23d20f2f04
commit
5f7b63071e
@ -0,0 +1,34 @@
|
||||
@if (Items != null)
|
||||
{
|
||||
@foreach (var item in Items)
|
||||
{
|
||||
<li @key="item.Id">
|
||||
<div class="row mb-2">
|
||||
<div class="col-1" style="width: 30px;">
|
||||
<input type="checkbox" class="form-check-input" style="vertical-align: middle" @bind-value="item.IsCompleted" checked="@item.IsCompleted"/>
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (item.IsCompleted)
|
||||
{
|
||||
<input type="text" class="form-control border-0 text-decoration-line-through" style="vertical-align: middle" @bind-value="item.Name" disabled/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" class="form-control border-0" style="vertical-align: middle" @bind-value="item.Name"/>
|
||||
}
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (item.IsCompleted)
|
||||
{
|
||||
<text>Completed at: @item.DateCompleted.ToLongDateString()</text>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public List<ToDoItem>? Items { get; set; }
|
||||
}
|
||||
@ -10,32 +10,7 @@
|
||||
@if (items != null && items.Count > 0)
|
||||
{
|
||||
<ul class="list-unstyled">
|
||||
@foreach (var item in items)
|
||||
{
|
||||
<li @key="item.Id">
|
||||
<div class="row mb-2">
|
||||
<div class="col-1" style="width: 30px;">
|
||||
<input type="checkbox" class="form-check-input" style="vertical-align: middle" @bind-value="item.IsCompleted" checked="@item.IsCompleted"/>
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (item.IsCompleted)
|
||||
{
|
||||
<input type="text" class="form-control border-0 text-decoration-line-through" style="vertical-align: middle" @bind-value="item.Name" disabled/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" class="form-control border-0" style="vertical-align: middle" @bind-value="item.Name"/>
|
||||
}
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (item.IsCompleted)
|
||||
{
|
||||
<text>Completed at: @item.DateCompleted.ToLongDateString()</text>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
<ToDoItemListComponent Items="items"></ToDoItemListComponent>
|
||||
</ul>
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user