-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathIndex.razor
More file actions
49 lines (45 loc) · 1.68 KB
/
Index.razor
File metadata and controls
49 lines (45 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@page "/"
@using ChartJs.Blazor.Samples.Shared
@inject ISamplesProvider samplesProvider
<div class="content">
<div class="header">
<div class="chartjs-title">Samples</div>
<div class="chartjs-caption">Brings <a target="_blank" href="https://www.chartjs.org/">Chart.js</a> to Blazor</div>
<div class="chartjs-links">
<a class="btn btn-gh" href="https://github.com/mariusmuntean/ChartJs.Blazor">GitHub</a>
</div>
</div>
<div id="categories" class="samples-categories">
@if (_sampleCategories == null)
{
<p>Loading..</p>
}
else
{
@foreach (SampleCategory category in _sampleCategories)
{
<div class="samples-category">
<div class="title">@category.Title</div>
<div class="items">
@foreach (Sample sample in category.Samples)
{
<div class="samples-entry">
<a class="title" href="@sample.Path">@sample.Title</a>
</div>
}
</div>
</div>
}
}
</div>
</div>
@code {
private IEnumerable<SampleCategory> _sampleCategories;
protected override async Task OnInitializedAsync()
{
// In Server-Mode, the file will be read directly from disk
// In Client-Mode, the file will be requested as static asset from the server over the network
// Pre-rendering is disabled, otherwise both mode variants would be called
_sampleCategories = await samplesProvider.GetSamples();
}
}