Ajout Blasorize

master
Thomas TISSIER 3 years ago
parent 5f2a1eb4a7
commit 4bfa49f0c2

@ -2,4 +2,35 @@
<h3>List</h3> <h3>List</h3>
@if (items != null)
{
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Display Name</th>
<th>Stack Size</th>
<th>Maximum Durability</th>
<th>Enchant Categories</th>
<th>Repair With</th>
<th>Created Date</th>
</tr>
</thead>
<tbody>
@foreach (var item in items)
{
<tr>
<td>@item.Id</td>
<td>@item.DisplayName</td>
<td>@item.StackSize</td>
<td>@item.MaxDurability</td>
<td>@(string.Join(", ", item.EnchantCategories))</td>
<td>@(string.Join(", ", item.RepairWith))</td>
<td>@item.CreatedDate.ToShortDateString()</td>
</tr>
}
</tbody>
</table>
}

@ -1,6 +1,21 @@
namespace TutoBlazer.Pages using Microsoft.AspNetCore.Components;
using TutoBlazer.Models;
namespace TutoBlazer.Pages
{ {
public partial class List public partial class List
{ {
private Item[] items;
[Inject]
public HttpClient Http { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
protected override async Task OnInitializedAsync()
{
items = await Http.GetFromJsonAsync<Item[]>($"{NavigationManager.BaseUri}fake-data.json");
}
} }
} }

@ -28,5 +28,10 @@
</div> </div>
<script src="_framework/blazor.server.js"></script> <script src="_framework/blazor.server.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
</body> </body>
</html> </html>

@ -1,3 +1,6 @@
using Blazorise;
using Blazorise.Bootstrap;
using Blazorise.Icons.FontAwesome;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
using TutoBlazer.Data; using TutoBlazer.Data;
@ -9,6 +12,10 @@ builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor(); builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>(); builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddHttpClient(); builder.Services.AddHttpClient();
builder.Services
.AddBlazorise()
.AddBootstrapProviders()
.AddFontAwesomeIcons();
var app = builder.Build(); var app = builder.Build();

@ -6,4 +6,10 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazorise.Bootstrap" Version="1.1.2" />
<PackageReference Include="Blazorise.DataGrid" Version="1.1.2" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.1.2" />
</ItemGroup>
</Project> </Project>

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TutoBlazer", "TutoBlazer.csproj", "{7CD1577B-C2D9-4882-A7F7-F97BD66B4977}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CD1577B-C2D9-4882-A7F7-F97BD66B4977}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {40DBD66E-A2AD-48B0-937B-2D07E4875D39}
EndGlobalSection
EndGlobal

@ -8,3 +8,4 @@
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using TutoBlazer @using TutoBlazer
@using TutoBlazer.Shared @using TutoBlazer.Shared
@using Blazorise.DataGrid

Loading…
Cancel
Save