Added basic configuration
This commit is contained in:
20
testing/HopFrame.Testing/Components/App.razor
Normal file
20
testing/HopFrame.Testing/Components/App.razor
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<base href="/"/>
|
||||
<link rel="stylesheet" href="@Assets["app.css"]"/>
|
||||
<link rel="stylesheet" href="@Assets["HopFrame.Testing.styles.css"]"/>
|
||||
<ImportMap/>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
|
||||
<HeadOutlet/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Routes/>
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
26
testing/HopFrame.Testing/Components/Layout/MainLayout.razor
Normal file
26
testing/HopFrame.Testing/Components/Layout/MainLayout.razor
Normal file
@@ -0,0 +1,26 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<FluentLayout>
|
||||
<FluentHeader>
|
||||
HopFrame.Testing
|
||||
</FluentHeader>
|
||||
<FluentStack Class="main" Orientation="Orientation.Horizontal" Width="100%">
|
||||
<NavMenu/>
|
||||
<FluentBodyContent Class="body-content">
|
||||
<div class="content">
|
||||
@Body
|
||||
</div>
|
||||
</FluentBodyContent>
|
||||
</FluentStack>
|
||||
<FluentFooter>
|
||||
<a href="https://www.fluentui-blazor.net" target="_blank">Documentation and demos</a>
|
||||
<FluentSpacer/>
|
||||
<a href="https://learn.microsoft.com/en-us/aspnet/core/blazor" target="_blank">About Blazor</a>
|
||||
</FluentFooter>
|
||||
</FluentLayout>
|
||||
|
||||
<div id="blazor-error-ui" data-nosnippet>
|
||||
An unhandled error has occurred.
|
||||
<a href="." class="reload">Reload</a>
|
||||
<span class="dismiss">🗙</span>
|
||||
</div>
|
||||
19
testing/HopFrame.Testing/Components/Layout/NavMenu.razor
Normal file
19
testing/HopFrame.Testing/Components/Layout/NavMenu.razor
Normal file
@@ -0,0 +1,19 @@
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<div class="navmenu">
|
||||
<input type="checkbox" title="Menu expand/collapse toggle" id="navmenu-toggle" class="navmenu-icon"/>
|
||||
<label for="navmenu-toggle" class="navmenu-icon">
|
||||
<FluentIcon Value="@(new Icons.Regular.Size20.Navigation())" Color="Color.Fill"/>
|
||||
</label>
|
||||
<nav class="sitenav" aria-labelledby="main-menu">
|
||||
<FluentNavMenu Id="main-menu" Collapsible="true" Width="250" Title="Navigation menu" @bind-Expanded="expanded" CustomToggle="true">
|
||||
<FluentNavLink Href="/" Match="NavLinkMatch.All" Icon="@(new Icons.Regular.Size20.Home())" IconColor="Color.Accent">Home</FluentNavLink>
|
||||
<FluentNavLink Href="counter" Icon="@(new Icons.Regular.Size20.NumberSymbolSquare())" IconColor="Color.Accent">Counter</FluentNavLink>
|
||||
<FluentNavLink Href="weather" Icon="@(new Icons.Regular.Size20.WeatherPartlyCloudyDay())" IconColor="Color.Accent">Weather</FluentNavLink>
|
||||
</FluentNavMenu>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private bool expanded = true;
|
||||
}
|
||||
21
testing/HopFrame.Testing/Components/Pages/Counter.razor
Normal file
21
testing/HopFrame.Testing/Components/Pages/Counter.razor
Normal file
@@ -0,0 +1,21 @@
|
||||
@page "/counter"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<div role="status" style="padding-bottom: 1em;">
|
||||
Current count: <FluentBadge Appearance="Appearance.Neutral">@currentCount</FluentBadge>
|
||||
</div>
|
||||
|
||||
<FluentButton Appearance="Appearance.Accent" @onclick="IncrementCount">Click me</FluentButton>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount() {
|
||||
currentCount++;
|
||||
}
|
||||
|
||||
}
|
||||
35
testing/HopFrame.Testing/Components/Pages/Error.razor
Normal file
35
testing/HopFrame.Testing/Components/Pages/Error.razor
Normal file
@@ -0,0 +1,35 @@
|
||||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (ShowRequestId) {
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
|
||||
@code{
|
||||
[CascadingParameter] private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? RequestId { get; set; }
|
||||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
protected override void OnInitialized() =>
|
||||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
|
||||
|
||||
}
|
||||
18
testing/HopFrame.Testing/Components/Pages/Home.razor
Normal file
18
testing/HopFrame.Testing/Components/Pages/Home.razor
Normal file
@@ -0,0 +1,18 @@
|
||||
@page "/"
|
||||
@using HopFrame.Core.Services
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new Fluent Blazor app.
|
||||
|
||||
@inject IContextExplorer Explorer
|
||||
|
||||
@code {
|
||||
|
||||
protected override void OnInitialized() {
|
||||
Console.WriteLine(string.Join(", ", Explorer.GetTableNames()));
|
||||
}
|
||||
|
||||
}
|
||||
48
testing/HopFrame.Testing/Components/Pages/Weather.razor
Normal file
48
testing/HopFrame.Testing/Components/Pages/Weather.razor
Normal file
@@ -0,0 +1,48 @@
|
||||
@page "/weather"
|
||||
@attribute [StreamRendering]
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates showing data.</p>
|
||||
|
||||
@if (forecasts == null) {
|
||||
<p>
|
||||
<em>Loading...</em>
|
||||
</p>
|
||||
}
|
||||
else {
|
||||
<!-- This page is rendered in SSR mode, so the FluentDataGrid component does not offer any interactivity (like sorting). -->
|
||||
<FluentDataGrid Id="weathergrid" Items="@forecasts" GridTemplateColumns="1fr 1fr 1fr 2fr" TGridItem="WeatherForecast">
|
||||
<PropertyColumn Title="Date" Property="@(c => c!.Date)" Align="Align.Start"/>
|
||||
<PropertyColumn Title="Temp. (C)" Property="@(c => c!.TemperatureC)" Align="Align.Center"/>
|
||||
<PropertyColumn Title="Temp. (F)" Property="@(c => c!.TemperatureF)" Align="Align.Center"/>
|
||||
<PropertyColumn Title="Summary" Property="@(c => c!.Summary)" Align="Align.End"/>
|
||||
</FluentDataGrid>
|
||||
}
|
||||
|
||||
@code {
|
||||
private IQueryable<WeatherForecast>? forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync() {
|
||||
// Simulate asynchronous loading to demonstrate streaming rendering
|
||||
await Task.Delay(500);
|
||||
|
||||
var startDate = DateOnly.FromDateTime(DateTime.Now);
|
||||
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
|
||||
forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast {
|
||||
Date = startDate.AddDays(index),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = summaries[Random.Shared.Next(summaries.Length)]
|
||||
}).AsQueryable();
|
||||
}
|
||||
|
||||
private class WeatherForecast {
|
||||
public DateOnly Date { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
|
||||
}
|
||||
6
testing/HopFrame.Testing/Components/Routes.razor
Normal file
6
testing/HopFrame.Testing/Components/Routes.razor
Normal file
@@ -0,0 +1,6 @@
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)"/>
|
||||
<FocusOnNavigate RouteData="routeData" Selector="h1"/>
|
||||
</Found>
|
||||
</Router>
|
||||
12
testing/HopFrame.Testing/Components/_Imports.razor
Normal file
12
testing/HopFrame.Testing/Components/_Imports.razor
Normal file
@@ -0,0 +1,12 @@
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.FluentUI.AspNetCore.Components
|
||||
@using Icons = Microsoft.FluentUI.AspNetCore.Components.Icons
|
||||
@using Microsoft.JSInterop
|
||||
@using HopFrame.Testing
|
||||
@using HopFrame.Testing.Components
|
||||
Reference in New Issue
Block a user