Skip to content

Commit aff9c86

Browse files
author
Jeremy Buentello
authored
Merge pull request #18 from Unskilledcrab/releases/github
Releases/GitHub
2 parents e98d534 + affb0bf commit aff9c86

File tree

19 files changed

+365
-180
lines changed

19 files changed

+365
-180
lines changed

Blatomic.Examples/Blatomic.Examples.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Blazy" Version="1.0.2" />
1615
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.1" />
1716
</ItemGroup>
1817

Blatomic.Examples/Pages/Dragdrop.razor

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@page "/dragdrop"
22
@inject ITheme Theme
3+
@inject ToastService ToastService
34

45
<PageTitle>Drag & Drop</PageTitle>
56

@@ -15,7 +16,7 @@
1516
on where they can and cannot place the dragged item. This will also work on touch devices like mobile!
1617
</p>
1718

18-
<div class="mb-2 max-w-2xl mx-auto flex justify-between p-4 border border-gray-400">
19+
<div class="mb-2 max-w-2xl flex justify-between p-4 border border-gray-400">
1920
<DragContext TData="int">
2021
<DragItem DragData="5" Copy="true">
2122
<div class="flex flex-col rounded-lg @Theme.Success.All">
@@ -87,7 +88,7 @@
8788
it contains the number <b>4</b>.
8889
</p>
8990

90-
<div class="mb-2 max-w-4xl mx-auto overflow-auto flex justify-between p-4 border border-gray-400">
91+
<div class="mb-2 max-w-4xl overflow-auto flex justify-between p-4 border border-gray-400">
9192
<DragContext TData="int">
9293
<div class="flex flex-col space-y-4">
9394
<DragItem DragData="5" Copy="true">
@@ -143,8 +144,8 @@
143144

144145
<div class="mb-2 overflow-auto flex justify-between">
145146
<DragContext TData="Card" ShowAllDropAreas="false">
146-
<DropArea Context="Items" Items="@cards" OnDropCompleteAsync="MarkToDoCard">
147-
<div class="border border-gray-400 p-4 w-96">
147+
<DropArea Context="Items" Items="@cards" OnDropComplete="MarkToDoCard">
148+
<div class="border border-gray-400 p-4 w-48 sm:w-96">
148149
<h2 class="border-b border-gray-500 mb-2">Backlog</h2>
149150
<div class="flex flex-col space-y-2">
150151
@foreach (var item in Items)
@@ -154,8 +155,8 @@
154155
</div>
155156
</div>
156157
</DropArea>
157-
<DropArea Context="Items" TData="Card" CanDropAsync="SeverityCheck" OnDropCompleteAsync="MarkInProgressCard">
158-
<div class="border border-gray-400 p-4 w-96">
158+
<DropArea Context="Items" TData="Card" CanDrop="SeverityCheck" OnDropComplete="MarkInProgressCard" OnDragEnter="ShowToastEnter" OnDragLeave="ShowToastLeave">
159+
<div class="border border-gray-400 p-4 w-48 sm:w-96">
159160
<h2 class="border-b border-gray-500 mb-2">Severe Items</h2>
160161
<div class="flex flex-col space-y-2">
161162
@foreach (var item in Items)
@@ -165,8 +166,8 @@
165166
</div>
166167
</div>
167168
</DropArea>
168-
<DropArea Context="Items" TData="Card" CanDropAsync="ProgressCheck" OnDropCompleteAsync="CompleteCard">
169-
<div class="border border-gray-400 p-4 w-96">
169+
<DropArea Context="Items" TData="Card" CanDrop="ProgressCheck" OnDropComplete="CompleteCard">
170+
<div class="border border-gray-400 p-4 w-48 sm:w-96">
170171
<h2 class="border-b border-gray-500 mb-2">Completed</h2>
171172
<div class="flex flex-col space-y-2">
172173
@foreach (var item in Items)
@@ -183,32 +184,47 @@
183184
</div>
184185

185186
@code {
186-
Task<bool> SeverityCheck(DragArgs<Card> card)
187+
void ShowToastEnter(DragArgs<Card> card)
188+
{
189+
ToastService.AddToast(new Toast { Header = "Transfer?", Message = $"{card.Data?.Name}" });
190+
}
191+
void ShowToastLeave(DragArgs<Card> card)
192+
{
193+
ToastService.AddToast(new Toast { Header = "Nope", Message = $"{card.Data?.Name}" });
194+
}
195+
bool SeverityCheck(DragArgs<Card> card)
187196
{
188197
var severity = card?.Data?.Severity;
189-
return Task.FromResult(severity == "Medium");
198+
return severity == "Medium";
190199
}
191-
Task<bool> ProgressCheck(DragArgs<Card> card)
200+
bool ProgressCheck(DragArgs<Card> card)
192201
{
193-
return Task.FromResult(card?.Data?.Status == "In Progress");
202+
return card?.Data?.Status == "In Progress";
194203
}
195-
Task MarkToDoCard(DragArgs<Card> card)
196-
{
197-
card.Data.Status = "To Do";
198-
card.Data.Severity = "Medium";
199-
return Task.CompletedTask;
204+
void MarkToDoCard(DragArgs<Card> card)
205+
{
206+
if (card.Data != null)
207+
{
208+
card.Data.Status = "To Do";
209+
card.Data.Severity = "Medium";
210+
}
200211
}
201-
Task MarkInProgressCard(DragArgs<Card> card)
202-
{
203-
card.Data.Status = "In Progress";
204-
card.Data.Severity = "High";
205-
return Task.CompletedTask;
212+
void MarkInProgressCard(DragArgs<Card> card)
213+
{
214+
if (card.Data != null)
215+
{
216+
card.Data.Status = "In Progress";
217+
card.Data.Severity = "High";
218+
}
219+
ToastService.AddToast(new Toast { Header = "New Work Item!", Message = $"{card.Data?.Name} has been moved to a Severe Item" });
206220
}
207-
Task CompleteCard(DragArgs<Card> card)
221+
void CompleteCard(DragArgs<Card> card)
208222
{
209-
card.Data.Status = "Complete";
210-
card.Data.Severity = "Done";
211-
return Task.CompletedTask;
223+
if (card.Data != null)
224+
{
225+
card.Data.Status = "Complete";
226+
card.Data.Severity = "Done";
227+
}
212228
}
213229

214230
List<Card> cards = new()
@@ -238,10 +254,10 @@
238254

239255
class Card
240256
{
241-
public string Name { get; set; }
242-
public string Description { get; set; }
243-
public string Severity { get; set; }
244-
public string Status { get; set; }
257+
public string? Name { get; set; }
258+
public string? Description { get; set; }
259+
public string? Severity { get; set; }
260+
public string? Status { get; set; }
245261
}
246262

247263
private RenderFragment<Card> CardFragment = card => __builder =>

Blatomic.Examples/Pages/Guides.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
to highlight specific subsections.
7676
</p>
7777

78-
<p class="my-2 max-w-xlg mx-auto">
78+
<p class="my-2 max-w-xlg">
7979
<GuideContext @bind-IsShowing="@isGuide2Showing">
8080
<div class="flex flex-col space-y-4">
8181

Blatomic.Examples/Pages/ProgressBars.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
Here we can manipulate the value of the progress bar and we are displaying that value to the user
3030
</p>
3131

32-
<p class="my-2 max-w-lg mx-auto">
32+
<p class="my-2 max-w-lg">
3333
<ProgressBar @bind-Percentage="@progress">@($"{progress}%")</ProgressBar>
3434
<div class="flex justify-around mt-2">
3535
<Button OnClickedAsync="(() => progress = 0)">0</Button>

Blatomic.Examples/Pages/Steppers.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
or they can click on the step number in the header to proceed directly to that step.
1616
</p>
1717

18-
<div class="max-w-xl mx-auto">
18+
<div class="max-w-xl">
1919
<Stepper>
2020
<Step>
2121
<div class="p-4">This is an introduction to the stepper component</div>
@@ -40,7 +40,7 @@
4040
if they have not agreed to the new terms first.
4141
</p>
4242

43-
<div class="max-w-xl mx-auto">
43+
<div class="max-w-xl">
4444
<Stepper>
4545
<Step Title="Intro">
4646
<div class="p-4">This will show you how to make sure that your user has completed a task before moving on to the next step</div>

Blatomic.Examples/Pages/Toasts.razor

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
</p>
3636

3737
<div class="mb-2">
38-
39-
<ToastContainer/>
40-
4138
<Button OnClickedAsync="CreateToastSmall">Create Small Toast</Button>
4239
<Button OnClickedAsync="CreateToastLarge">Create Large Toast</Button>
4340
</div>

Blatomic.Examples/Pages/Tools.razor

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,26 @@
88

99
<p class="my-2 font-medium">
1010
These are just some personal tools that I've made that have assisted me with building this project.
11+
</p>
12+
13+
<h3 class="text-xl font-bold mt-12 @TwColors.Text_Slate_900">Code Block Creator</h3>
14+
<p class="my-2 font-medium">
1115
You can place any text below to show it in the code block
1216
<i>
1317
(except it will convert single quotes to double quotes)
14-
</i>
18+
</i>.
19+
This is used to make all of the strings that are sent to code blocks since they need to
20+
be escaped in C# when you have an <b>@("@")</b> symbol
1521
</p>
16-
1722
<textarea class="mb-2 w-full h-80" placeholder="input strings with single quotes here" @bind="@Value"></textarea>
1823

1924
<CodeBlock Title=".razor" Code="@output" />
2025
</div>
2126

2227

2328
@code {
24-
private string output = "test";
25-
private string value;
29+
private string output = string.Empty;
30+
private string value = string.Empty;
2631
public string Value
2732
{
2833
get => value;

Blatomic.Examples/Shared/MainLayout.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
<PageTitle>Blatomic Examples</PageTitle>
88

9+
10+
<ToastContainer/>
911
<div class="@darkClass">
1012

1113
<div class="@Theme.Light.All fixed inset-0 overflow-y-auto">

Blatomic/Blatomic.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.1" />
2828
<PackageReference Include="Microsoft.AspNetCore.Razor" Version="2.2.0" />
2929
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
30+
<PackageReference Include="System.Linq.Async" Version="5.1.0" />
3031
</ItemGroup>
3132

3233
<ItemGroup>

Blatomic/Components/Drag/DragArgs.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,29 @@ namespace Blatomic.Components.Drag
44
{
55
public class DragArgs<TData> : EventArgs
66
{
7-
public DragArgs(TData data)
7+
public DragArgs(TData? data)
88
{
99
Data = data;
1010
}
11-
public DragArgs(DragEventArgs e, TData data)
11+
public DragArgs(TData? data, TouchEventArgs? touchArgs, DragEventArgs? dragArgs)
12+
{
13+
Data = data;
14+
TouchEventArgs = touchArgs;
15+
DragEventArgs = dragArgs;
16+
}
17+
public DragArgs(TouchEventArgs e, TData? data)
18+
{
19+
TouchEventArgs = e;
20+
Data = data;
21+
}
22+
public DragArgs(DragEventArgs e, TData? data)
1223
{
1324
DragEventArgs = e;
1425
Data = data;
1526
}
1627
public TData? Data { get; set; }
1728
public DragEventArgs? DragEventArgs { get; set; }
29+
public TouchEventArgs? TouchEventArgs { get; set; }
1830
}
1931

2032
public static class DragArgsExtensions

0 commit comments

Comments
 (0)