-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
289de9f
commit 09bd7fd
Showing
10 changed files
with
80 additions
and
6 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
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 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 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 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 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
53 changes: 53 additions & 0 deletions
53
src/BlazorInteractive/Components/Editor/NuGetComponent.razor
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,53 @@ | ||
@inject IPackageGetter NuGetPackageGetter | ||
@inject IToastService ToastService | ||
|
||
<div class="input-group mb-3"> | ||
<div class="input-group-prepend"> | ||
<img src="https://raw.githubusercontent.com/NuGet/Media/main/Images/MainLogo/Vector/nuget.svg" | ||
alt="NuGet logo" height="25px" /> | ||
</div> | ||
<input type="text" class="form-control" placeholder="Search Term" aria-label="Search Term" @bind="SearchTerm" @bind:event="oninput"/> | ||
<div class="input-group-append"> | ||
<button class="btn btn-outline-secondary" type="button" @onclick="GetPackage">Add</button> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
@if (Data != null) | ||
{ | ||
foreach (var item in Data.Where(i => i is not null)) | ||
{ | ||
<label class="form-check-label" for="@($"{item}")"> | ||
@($"{item}") | ||
</label> | ||
} | ||
} | ||
</div> | ||
|
||
@code { | ||
//[Parameter] | ||
string? SearchTerm { get; set; } | ||
|
||
[Parameter] | ||
public List<string> Data { get; set; } = new List<string>(); | ||
|
||
private async void GetPackage() | ||
{ | ||
var package = await NuGetPackageGetter.GetPackage(SearchTerm); | ||
package.Switch( | ||
success => | ||
{ | ||
Console.WriteLine("Success"); | ||
ToastService.ShowSuccess("Added NuGet Package"); | ||
Data.Add(SearchTerm); | ||
}, | ||
failure => | ||
{ | ||
Console.WriteLine("Failure"); | ||
ToastService.ShowError("Failed to add"); | ||
} | ||
); | ||
StateHasChanged(); | ||
} | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
src/BlazorInteractive/Components/Editor/NuGetComponent.razor.css
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,3 @@ | ||
img { | ||
margin-right: 10px; | ||
} |
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 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