-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor CSS formatting in SortableList.razor.css and app.css
- Loading branch information
Your Name
committed
Dec 26, 2023
1 parent
5f717f2
commit 1c19362
Showing
12 changed files
with
354 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,5 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<main> | ||
<a class="button is-dark is-pulled-right mr-4" href="https://github.com/the-urlist/blazorsortable" target="_blank"> | ||
<span class="icon"> | ||
<i class="fab fa-github"></i> | ||
</span> | ||
<span>View on GitHub</span> | ||
</a> | ||
<div class="columns m-5"> | ||
<div class="column is-narrow"> | ||
<aside class="menu"> | ||
<p class="menu-label"> | ||
Sortable Lists | ||
</p> | ||
<ul class="menu-list"> | ||
<li> | ||
<a href="singlelist">Single List</a> | ||
<ul> | ||
<li> | ||
<a href="draghandles">Drag Handles</a> | ||
</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<a href="multiplelists">Multiple Lists</a> | ||
</li> | ||
</ul> | ||
</aside> | ||
</div> | ||
<div class="column"> | ||
@Body | ||
</div> | ||
</div> | ||
@Body | ||
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<div class="container"> | ||
<h1 class="title is-size-1 has-text-centered">Cloning</h1> | ||
<p class="mb-4">Cloning is enabled by the "Pull='Clone'" property. This allows cloning of an item by dropping it into a shared list.</p> | ||
<Tabs CodeContent="Test"> | ||
<ExampleContent> | ||
<div class="columns"> | ||
<div class="column"> | ||
<SortableList Group="cloning" Pull="clone" Items="items1" Context="item" OnRemove="ListOneRemove"> | ||
<SortableItemTemplate> | ||
<div class="has-border has-background-blazor has-text-white"> | ||
<p class="is-size-4 p-2 ml-4">@item.Name</p> | ||
</div> | ||
</SortableItemTemplate> | ||
</SortableList> | ||
</div> | ||
<div class="column"> | ||
<SortableList Group="cloning" Pull="clone" OnRemove="ListTwoRemove" Items="items2" Context="item"> | ||
<SortableItemTemplate> | ||
<div class="has-border has-background-blazor has-text-white"> | ||
<p class="is-size-4 p-2 ml-4">@item.Name</p> | ||
|
||
</div> | ||
</SortableItemTemplate> | ||
</SortableList> | ||
</div> | ||
</div> | ||
</ExampleContent> | ||
</Tabs> | ||
</div> | ||
|
||
@code { | ||
|
||
private bool showCode = false; | ||
|
||
public class Item | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } = ""; | ||
} | ||
|
||
public List<Item> items1 = Enumerable.Range(1, 10).Select(i => new Item { Id = i, Name = $"Item {i}" }).ToList(); | ||
|
||
public List<Item> items2 = Enumerable.Range(11, 10).Select(i => new Item { Id = i, Name = $"Item {i}" }).ToList(); | ||
|
||
private void ListOneRemove((int oldIndex, int newIndex) indices) | ||
{ | ||
// get the item at the old index in list 1 | ||
var item = items1[indices.oldIndex]; | ||
|
||
// make a copy | ||
var clone = item; | ||
|
||
// add it to the new index in list 2 | ||
items2.Insert(indices.newIndex, clone); | ||
} | ||
|
||
private void ListTwoRemove((int oldIndex, int newIndex) indices) | ||
{ | ||
// get the item at the old index in list 2 | ||
var item = items2[indices.oldIndex]; | ||
|
||
// add it to the new index in list 1 | ||
items1.Insert(indices.newIndex, item); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<div class="container"> | ||
<h1 class="title is-size-1 has-text-centered">Shared Lists</h1> | ||
<p class="mb-4">Shared lists are lists where items can be dragged from one list to the other and vice-versa. Providing the same "Group" string name for both lists is what links them together. Note that when an item is dragged into a different list, it assumes the visual style of that list. This is because Blazor controls the rendering of the list items.</p> | ||
<Tabs CodeContent="@codeContent"> | ||
<ExampleContent> | ||
<div class="columns"> | ||
<div class="column"> | ||
<SortableList Group="sharedLists" Items="items1" Context="item" OnRemove="ListOneRemove"> | ||
<SortableItemTemplate> | ||
<div class=" card has-border has-background-white"> | ||
<p class="is-size-4 p-2 ml-4">@item.Name</p> | ||
</div> | ||
</SortableItemTemplate> | ||
</SortableList> | ||
</div> | ||
<div class="column"> | ||
<SortableList Group="sharedLists" OnRemove="ListTwoRemove" Items="items2" Context="item"> | ||
<SortableItemTemplate> | ||
<div class="card has-background-white has-border"> | ||
<p class="is-size-4 p-2 ml-4">@item.Name</p> | ||
</div> | ||
</SortableItemTemplate> | ||
</SortableList> | ||
</div> | ||
</div> | ||
</ExampleContent> | ||
</Tabs> | ||
</div> | ||
|
||
@code { | ||
|
||
private string codeContent = $@" | ||
<SortableList Group=""sharedLists"" Items=""items1"" Context=""item"" OnRemove=""ListOneRemove""> | ||
<SortableItemTemplate> | ||
<div class="" card has-border has-background-white""> | ||
<p class=""is-size-4 p-2 ml-4"">@item.Name</p> | ||
</div> | ||
</SortableItemTemplate> | ||
</SortableList> | ||
<SortableList Group=""sharedLists"" OnRemove=""ListTwoRemove"" Items=""items2"" Context=""item""> | ||
<SortableItemTemplate> | ||
<div class=""card has-background-white has-border""> | ||
<p class=""is-size-4 p-2 ml-4"">@item.Name</p> | ||
</div> | ||
</SortableItemTemplate> | ||
</SortableList> | ||
@code {{ | ||
private void ListOneRemove((int oldIndex, int newIndex) indices) | ||
{{ | ||
// get the item at the old index in list 1 | ||
var item = items1[indices.oldIndex]; | ||
// add it to the new index in list 2 | ||
items2.Insert(indices.newIndex, item); | ||
// remove the item from the old index in list 1 | ||
items1.Remove(items1[indices.oldIndex]); | ||
}} | ||
private void ListTwoRemove((int oldIndex, int newIndex) indices) | ||
{{ | ||
// get the item at the old index in list 2 | ||
var item = items2[indices.oldIndex]; | ||
// add it to the new index in list 1 | ||
items1.Insert(indices.newIndex, item); | ||
// remove the item from the old index in list 2 | ||
items2.Remove(items2[indices.oldIndex]); | ||
}} | ||
}} | ||
"; | ||
public class Item | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } = ""; | ||
|
||
} | ||
|
||
public List<Item> items1 = Enumerable.Range(1, 10).Select(i => new Item { Id = i, Name = $"Item {i}" }).ToList(); | ||
|
||
public List<Item> items2 = Enumerable.Range(11, 10).Select(i => new Item { Id = i, Name = $"Item {i}" }).ToList(); | ||
|
||
private void ListOneRemove((int oldIndex, int newIndex) indices) | ||
{ | ||
// get the item at the old index in list 1 | ||
var item = items1[indices.oldIndex]; | ||
|
||
// add it to the new index in list 2 | ||
items2.Insert(indices.newIndex, item); | ||
|
||
// remove the item from the old index in list 1 | ||
items1.Remove(items1[indices.oldIndex]); | ||
} | ||
|
||
private void ListTwoRemove((int oldIndex, int newIndex) indices) | ||
{ | ||
// get the item at the old index in list 2 | ||
var item = items2[indices.oldIndex]; | ||
|
||
// add it to the new index in list 1 | ||
items1.Insert(indices.newIndex, item); | ||
|
||
// remove the item from the old index in list 2 | ||
items2.Remove(items2[indices.oldIndex]); | ||
} | ||
} |
Oops, something went wrong.