Skip to content

Commit eea143e

Browse files
committed
Added test projects and inlines BlazorSpaces styling for now
1 parent 7793c89 commit eea143e

38 files changed

Lines changed: 1504 additions & 2 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
10+
<ItemGroup>
11+
<SupportedPlatform Include="browser" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.2" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\BlazorBook\BlazorBook.csproj" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@inherits BlazorBook.StoryComponent
2+
@attribute [DisplayName("Hello world")]
3+
4+
<div class="my-component">
5+
This component is defined in the <strong>BlazorBook.Test.Stories</strong> library.
6+
</div>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.my-component {
2+
border: 2px dashed red;
3+
padding: 1em;
4+
margin: 1em 0;
5+
background-image: url('background.png');
6+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@using Microsoft.AspNetCore.Components.Web
2+
@using System.ComponentModel
378 Bytes
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This is a JavaScript module that is loaded on demand. It can export any number of
2+
// functions, and may import other JavaScript modules if required.
3+
4+
export function showPrompt(message) {
5+
return prompt(message, 'Type anything here');
6+
}

BlazorBook.Test/App.razor

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<BlazorBook.Resources />
2+
3+
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="new[] { typeof(BlazorBook.UI).Assembly }">
4+
<Found Context="routeData">
5+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
6+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
7+
</Found>
8+
<NotFound>
9+
<PageTitle>Not found</PageTitle>
10+
<LayoutView Layout="@typeof(MainLayout)">
11+
<p role="alert">Sorry, there's nothing at this address.</p>
12+
</LayoutView>
13+
</NotFound>
14+
</Router>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.2" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.2" PrivateAssets="all" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\BlazorBook.Test.Stories\BlazorBook.Test.Stories.csproj" />
16+
<ProjectReference Include="..\BlazorBook\BlazorBook.csproj" />
17+
</ItemGroup>
18+
19+
</Project>

BlazorBook.Test/Pages/Index.razor

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@page "/"
2+
@inject NavigationManager NavManager
3+
4+
@code {
5+
protected override void OnInitialized()
6+
{
7+
NavManager.NavigateTo("/blazorbook");
8+
}
9+
}

BlazorBook.Test/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using BlazorBook.Test;
2+
using Microsoft.AspNetCore.Components.Web;
3+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
4+
using System.Reflection;
5+
using BlazorBook;
6+
7+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
8+
builder.RootComponents.Add<App>("#app");
9+
builder.RootComponents.Add<HeadOutlet>("head::after");
10+
builder.RegisterAllStories(Assembly.Load("BlazorBook.Test.Stories"));
11+
12+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
13+
14+
await builder.Build().RunAsync();

0 commit comments

Comments
 (0)