File tree Expand file tree Collapse file tree 12 files changed +236
-6
lines changed
src/Mvc/samples/MvcSandbox Expand file tree Collapse file tree 12 files changed +236
-6
lines changed Original file line number Diff line number Diff line change 1+
2+ <Router AppAssembly =" @typeof(MvcSandbox.Startup).Assembly" FallbackComponent =" @typeof(NotFound)" />
Original file line number Diff line number Diff line change 1+ @using MvcSandbox .Components .Shared
2+ @layout MainLayout
3+ <h1 >Not Found</h1 >
4+ <h2 >Sorry, nothing was found.</h2 >
Original file line number Diff line number Diff line change 1+ @page " /"
2+ <h3 >Hi from components</h3 >
Original file line number Diff line number Diff line change 1+ @using MvcSandbox .Components .Shared
2+ @layout MainLayout
Original file line number Diff line number Diff line change 1+ @using Microsoft .AspNetCore .Components .Layouts
2+ @inherits LayoutComponentBase
3+
4+ <div class =" sidebar" >
5+ <NavMenu />
6+ </div >
7+
8+ <div class =" main" >
9+ <div class =" top-row px-4" >
10+ <a href =" https://docs.microsoft.com/en-us/aspnet/" target =" _blank" class =" ml-md-auto" >About</a >
11+ </div >
12+
13+ <div class =" content px-4" >
14+ @Body
15+ </div >
16+ </div >
Original file line number Diff line number Diff line change 1+ @using Microsoft .AspNetCore .Components .Routing
2+
3+ <div class =" top-row pl-4 navbar navbar-dark" >
4+ <a class =" navbar-brand" href =" " >MvcSandbox</a >
5+ <button class =" navbar-toggler" onclick =" @ToggleNavMenu" >
6+ <span class =" navbar-toggler-icon" ></span >
7+ </button >
8+ </div >
9+
10+ <div class =" @NavMenuCssClass" onclick =" @ToggleNavMenu" >
11+ <ul class =" nav flex-column" >
12+ <li class =" nav-item px-3" >
13+ <NavLink class =" nav-link" href =" " Match =" NavLinkMatch.All" >
14+ <span class =" oi oi-home" aria-hidden =" true" ></span > Home
15+ </NavLink >
16+ </li >
17+ </ul >
18+ </div >
19+
20+ @functions {
21+ bool collapseNavMenu = true ;
22+
23+ string NavMenuCssClass => collapseNavMenu ? " collapse" : null ;
24+
25+ void ToggleNavMenu ()
26+ {
27+ collapseNavMenu = ! collapseNavMenu ;
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ @namespace MvcSandbox.Components
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <TargetFramework >netcoreapp3.0</TargetFramework >
5+ <_RazorComponentInclude >Components\**\*.cshtml</_RazorComponentInclude >
56 </PropertyGroup >
67
78 <ItemGroup >
89 <Reference Include =" Microsoft.AspNetCore.Mvc" />
910 <Reference Include =" Microsoft.AspNetCore.Mvc.NewtonsoftJson" />
1011 <Reference Include =" Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" />
12+ <Reference Include =" Microsoft.AspNetCore.Components.Server" />
1113 <Reference Include =" Microsoft.AspNetCore.Diagnostics" />
1214 <Reference Include =" Microsoft.AspNetCore.Server.IISIntegration" />
1315 <Reference Include =" Microsoft.AspNetCore.Server.Kestrel" />
Original file line number Diff line number Diff line change 1+ @page
2+ @model MvcSandbox .Pages .ComponentsModel
3+ @{
4+ Layout = null ;
5+ }
6+
7+ <!DOCTYPE html>
8+ <html >
9+ <head >
10+ <meta charset =" utf-8" />
11+ <meta name =" viewport" content =" width=device-width, initial-scale=1.0" />
12+ <title >MvcSandbox - Components</title >
13+ <base href =" ~/" />
14+ <link rel =" stylesheet" href =" https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css" />
15+ <link href =" css/site.css" rel =" stylesheet" />
16+ </head >
17+ <body >
18+ <app >@( await Html .RenderComponentAsync <MvcSandbox .Components .App >()) </app >
19+
20+ <script src =" _framework/components.server.js" ></script >
21+ </body >
22+ </html >
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Threading . Tasks ;
5+ using Microsoft . AspNetCore . Mvc ;
6+ using Microsoft . AspNetCore . Mvc . RazorPages ;
7+
8+ namespace MvcSandbox . Pages
9+ {
10+ public class ComponentsModel : PageModel
11+ {
12+ public void OnGet ( )
13+ {
14+ }
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments