1
0
Fork 0
mirror of https://github.com/miawinter98/just-short-it.git synced 2024-11-10 03:59:53 +00:00

added: blazor static component rendering support

This commit is contained in:
Mia Rose Winter 2023-11-18 13:41:14 +01:00
parent 95c0634c22
commit dee6653214
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
6 changed files with 59 additions and 0 deletions

25
Components/App.razor Normal file
View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
@* ReSharper disable once MissingTitleTag :: Added by HeadOutlet *@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="/css/main.min.css" asp-append-version="true" />
<HeadOutlet />
</head>
<body>
<Routes />
<script src="_framework/blazor.web.js"></script>
</body>
</html>

View file

@ -0,0 +1,3 @@
@inherits LayoutComponentBase
@Body

View file

@ -0,0 +1,9 @@
@page "/about"
<PageTitle>About - Just Short It</PageTitle>
<h2 class="text-2xl lg:text-4xl">About</h2>
@code {
}

6
Components/Routes.razor Normal file
View 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>

10
Components/_imports.razor Normal file
View file

@ -0,0 +1,10 @@
@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.JSInterop
@using JustShortIt
@using JustShortIt.Components

View file

@ -1,3 +1,4 @@
using JustShortIt.Components;
using JustShortIt.Model;
using JustShortIt.Service;
using Microsoft.AspNetCore.Authentication.Cookies;
@ -6,6 +7,9 @@
builder.Configuration.AddEnvironmentVariables("JSI_");
builder.Services.AddRazorPages();
builder.Services.AddAntiforgery();
builder.Services.AddRazorComponents();
// Get Configurations
var redisConnection = builder.Configuration.GetSection("Redis").Get<RedisConnection>();
var user = builder.Configuration.GetSection("Account").Get<User>();
@ -65,5 +69,7 @@
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseAntiforgery();
app.MapRazorPages();
app.MapRazorComponents<App>();
app.Run();