Skip to content

Commit 1bfc1bf

Browse files
Refactored, Added NuGet Package
1 parent b49b521 commit 1bfc1bf

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

src/BlazorQuery.Library/BlazorQuery.Library.csproj

+24
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@
55
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
66
<AssemblyName>BlazorQuery</AssemblyName>
77
<RootNamespace>BlazorQuery</RootNamespace>
8+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
9+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
10+
<Version>0.0.1</Version>
11+
<Authors>KevinJPetersen</Authors>
12+
<RepositoryUrl>https://github.com/kevinjpetersen/BlazorQuery</RepositoryUrl>
13+
<PackageProjectUrl>https://github.com/kevinjpetersen/BlazorQuery</PackageProjectUrl>
14+
<RepositoryType>GitHub</RepositoryType>
15+
<PackageTags>Blazor, Razor, jQuery, Query, CSharp, DOM, Manipulation</PackageTags>
16+
<PackageReleaseNotes>Version 0.0.1 - 2019-07-09 | Functionality added
17+
* Added Select (Equivalent to $/jQuery, to select elements)
18+
* Added AddClass, RemoveClass,
19+
* Added Height (Set &amp; Get), Width (Set &amp; Get)
20+
* Added Text (Set &amp; Get)
21+
* Added CSS</PackageReleaseNotes>
22+
<Description>BlazorQuery is a Blazor Library that wraps jQuery completely in C# so that DOM Manipulation, Ajax, etc, can be done directly without leaving the comfort of C#.</Description>
23+
<Copyright>MIT License</Copyright>
24+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
825
</PropertyGroup>
926

1027
<ItemGroup>
@@ -25,4 +42,11 @@
2542
<EmbeddedResource Remove="wwwroot\jquery.js" />
2643
</ItemGroup>
2744

45+
<ItemGroup>
46+
<None Include="..\..\LICENSE">
47+
<Pack>True</Pack>
48+
<PackagePath></PackagePath>
49+
</None>
50+
</ItemGroup>
51+
2852
</Project>

src/BlazorQuery.TestApp/Pages/Index.razor

+9-11
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@
66

77
<button @onclick="@(async () => await Trigger())">Trigger</button>
88

9-
@functions {
9+
@code {
1010

11-
async Task Trigger()
11+
protected override async Task OnAfterRenderAsync()
1212
{
13-
int width = await DOM.Select("h1").AddClass("this-class-has-blue-bg").CSS("color", "rebeccapurple").Text("Both of these are now this").Width();
14-
await DOM.ConsoleLog($"Width: {width}");
15-
16-
await DOM.Select("h1").Width(100);
17-
18-
int newWidth = await DOM.Select("h1").Width();
19-
await DOM.ConsoleLog($"Width: {newWidth}");
13+
await DOM.Select("h1").CSS("background-color", "red");
2014

21-
string text = await DOM.Select("h1").Text();
22-
await DOM.ConsoleLog($"Text: {text}");
15+
int width = await DOM.Select("h1").Width();
16+
await DOM.Select("h1").Width(Convert.ToInt32(width / 2));
17+
}
2318

19+
async Task Trigger()
20+
{
21+
await DOM.Select("h1").Text("Now this text is changed").CSS("color", "yellow");
2422
}
2523

2624
}

src/BlazorQuery.TestApp/Startup.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public Startup(IConfiguration configuration)
2626
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
2727
public void ConfigureServices(IServiceCollection services)
2828
{
29+
services.AddBlazorQuery();
2930
services.AddRazorPages();
3031
services.AddServerSideBlazor();
31-
services.AddBlazorQuery();
3232
services.AddSingleton<WeatherForecastService>();
3333
}
3434

0 commit comments

Comments
 (0)