mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Add blazor skeleton.
This commit is contained in:
20
RomRepoMgr.Blazor/Components/App.razor
Normal file
20
RomRepoMgr.Blazor/Components/App.razor
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<base href="/"/>
|
||||
<link href="@Assets["app.css"]" rel="stylesheet"/>
|
||||
<link href="@Assets["RomRepoMgr.Blazor.styles.css"]" rel="stylesheet"/>
|
||||
<ImportMap/>
|
||||
<link href="favicon.ico" rel="icon" type="image/x-icon"/>
|
||||
<HeadOutlet/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Routes/>
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
26
RomRepoMgr.Blazor/Components/Layout/MainLayout.razor
Normal file
26
RomRepoMgr.Blazor/Components/Layout/MainLayout.razor
Normal file
@@ -0,0 +1,26 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<FluentLayout>
|
||||
<FluentHeader>
|
||||
RomRepoMgr.Blazor
|
||||
</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 data-nosnippet id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a class="reload" href=".">Reload</a>
|
||||
<span class="dismiss">🗙</span>
|
||||
</div>
|
||||
19
RomRepoMgr.Blazor/Components/Layout/NavMenu.razor
Normal file
19
RomRepoMgr.Blazor/Components/Layout/NavMenu.razor
Normal file
@@ -0,0 +1,19 @@
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<div class="navmenu">
|
||||
<input class="navmenu-icon" id="navmenu-toggle" title="Menu expand/collapse toggle" type="checkbox"/>
|
||||
<label class="navmenu-icon" for="navmenu-toggle">
|
||||
<FluentIcon Color="Color.Fill" Value="@(new Icons.Regular.Size20.Navigation())"/>
|
||||
</label>
|
||||
<nav aria-labelledby="main-menu" class="sitenav">
|
||||
<FluentNavMenu @bind-Expanded="expanded" Collapsible="true" CustomToggle="true" Id="main-menu" Title="Navigation menu" Width="250">
|
||||
<FluentNavLink Href="/" Icon="@(new Icons.Regular.Size20.Home())" IconColor="Color.Accent" Match="NavLinkMatch.All">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;
|
||||
}
|
||||
22
RomRepoMgr.Blazor/Components/Pages/Counter.razor
Normal file
22
RomRepoMgr.Blazor/Components/Pages/Counter.razor
Normal file
@@ -0,0 +1,22 @@
|
||||
@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
RomRepoMgr.Blazor/Components/Pages/Error.razor
Normal file
35
RomRepoMgr.Blazor/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;
|
||||
}
|
||||
7
RomRepoMgr.Blazor/Components/Pages/Home.razor
Normal file
7
RomRepoMgr.Blazor/Components/Pages/Home.razor
Normal file
@@ -0,0 +1,7 @@
|
||||
@page "/"
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new Fluent Blazor app.
|
||||
51
RomRepoMgr.Blazor/Components/Pages/Weather.razor
Normal file
51
RomRepoMgr.Blazor/Components/Pages/Weather.razor
Normal file
@@ -0,0 +1,51 @@
|
||||
@page "/weather"
|
||||
@attribute [StreamRendering]
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates showing data.</p>
|
||||
|
||||
<!-- This page is rendered in SSR mode, so the FluentDataGrid component does not offer any interactivity (like sorting). -->
|
||||
<FluentDataGrid GridTemplateColumns="1fr 1fr 1fr 2fr" Id="weathergrid" Items="@forecasts" Loading="@(forecasts == null)" Style="height:204px;" TGridItem="WeatherForecast">
|
||||
<PropertyColumn Align="Align.Start" Property="@(c => c!.Date)" Title="Date"/>
|
||||
<PropertyColumn Align="Align.Center" Property="@(c => c!.TemperatureC)" Title="Temp. (C)"/>
|
||||
<PropertyColumn Align="Align.Center" Property="@(c => c!.TemperatureF)" Title="Temp. (F)"/>
|
||||
<PropertyColumn Align="Align.End" Property="@(c => c!.Summary)" Title="Summary"/>
|
||||
</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
RomRepoMgr.Blazor/Components/Routes.razor
Normal file
6
RomRepoMgr.Blazor/Components/Routes.razor
Normal file
@@ -0,0 +1,6 @@
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView DefaultLayout="typeof(Layout.MainLayout)" RouteData="routeData"/>
|
||||
<FocusOnNavigate RouteData="routeData" Selector="h1"/>
|
||||
</Found>
|
||||
</Router>
|
||||
12
RomRepoMgr.Blazor/Components/_Imports.razor
Normal file
12
RomRepoMgr.Blazor/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 RomRepoMgr.Blazor
|
||||
@using RomRepoMgr.Blazor.Components
|
||||
Reference in New Issue
Block a user