mirror of
https://github.com/miawinter98/just-short-it.git
synced 2024-11-22 00:09:54 +00:00
added: blazor static component rendering support
This commit is contained in:
parent
95c0634c22
commit
dee6653214
25
Components/App.razor
Normal file
25
Components/App.razor
Normal 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>
|
3
Components/Layout/MainLayout.razor
Normal file
3
Components/Layout/MainLayout.razor
Normal file
|
@ -0,0 +1,3 @@
|
|||
@inherits LayoutComponentBase
|
||||
|
||||
@Body
|
9
Components/Pages/About.razor
Normal file
9
Components/Pages/About.razor
Normal 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
6
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>
|
10
Components/_imports.razor
Normal file
10
Components/_imports.razor
Normal 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
|
|
@ -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();
|
Loading…
Reference in a new issue