Skip to content

Commit

Permalink
Refactored, Added NuGet Package
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjpetersen committed Jul 9, 2019
1 parent b49b521 commit 1bfc1bf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
24 changes: 24 additions & 0 deletions src/BlazorQuery.Library/BlazorQuery.Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<AssemblyName>BlazorQuery</AssemblyName>
<RootNamespace>BlazorQuery</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>0.0.1</Version>
<Authors>KevinJPetersen</Authors>
<RepositoryUrl>https://github.com/kevinjpetersen/BlazorQuery</RepositoryUrl>
<PackageProjectUrl>https://github.com/kevinjpetersen/BlazorQuery</PackageProjectUrl>
<RepositoryType>GitHub</RepositoryType>
<PackageTags>Blazor, Razor, jQuery, Query, CSharp, DOM, Manipulation</PackageTags>
<PackageReleaseNotes>Version 0.0.1 - 2019-07-09 | Functionality added
* Added Select (Equivalent to $/jQuery, to select elements)
* Added AddClass, RemoveClass,
* Added Height (Set &amp; Get), Width (Set &amp; Get)
* Added Text (Set &amp; Get)
* Added CSS</PackageReleaseNotes>
<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>
<Copyright>MIT License</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,4 +42,11 @@
<EmbeddedResource Remove="wwwroot\jquery.js" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
20 changes: 9 additions & 11 deletions src/BlazorQuery.TestApp/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@

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

@functions {
@code {

async Task Trigger()
protected override async Task OnAfterRenderAsync()
{
int width = await DOM.Select("h1").AddClass("this-class-has-blue-bg").CSS("color", "rebeccapurple").Text("Both of these are now this").Width();
await DOM.ConsoleLog($"Width: {width}");

await DOM.Select("h1").Width(100);

int newWidth = await DOM.Select("h1").Width();
await DOM.ConsoleLog($"Width: {newWidth}");
await DOM.Select("h1").CSS("background-color", "red");

string text = await DOM.Select("h1").Text();
await DOM.ConsoleLog($"Text: {text}");
int width = await DOM.Select("h1").Width();
await DOM.Select("h1").Width(Convert.ToInt32(width / 2));
}

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

}
2 changes: 1 addition & 1 deletion src/BlazorQuery.TestApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public Startup(IConfiguration configuration)
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddBlazorQuery();
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddBlazorQuery();
services.AddSingleton<WeatherForecastService>();
}

Expand Down

0 comments on commit 1bfc1bf

Please sign in to comment.