Skip to content

Commit 4558e95

Browse files
authored
MudListExtended (#99)
* Initialize * AddMudExtensions for the services * Some changes * Component Page Intro Design * Website Design * Last Design Improvements * Cleanup
1 parent be25542 commit 4558e95

File tree

71 files changed

+4688
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+4688
-17
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</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.9.*" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.9.*" PrivateAssets="all" />
12+
<PackageReference Include="System.Net.Http.Json" Version="6.0.0.*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\CodeBeam.MudExtensions\CodeBeam.MudExtensions.csproj" />
17+
</ItemGroup>
18+
19+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@page "/"
2+
3+
<PageTitle>Index</PageTitle>
4+
5+
<h1>Hello, world!</h1>
6+
7+
Welcome to your new app.
8+
9+
<SurveyPrompt Title="How is Blazor working for you?" />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using CodeBeam.MudExtensions.UnitTest.Viewer;
2+
using Microsoft.AspNetCore.Components.Web;
3+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
4+
5+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
6+
builder.RootComponents.Add<App>("#app");
7+
builder.RootComponents.Add<HeadOutlet>("head::after");
8+
9+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
10+
11+
await builder.Build().RunAsync();
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:7453",
7+
"sslPort": 44305
8+
}
9+
},
10+
"profiles": {
11+
"http": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
16+
"applicationUrl": "http://localhost:5232",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"https": {
22+
"commandName": "Project",
23+
"dotnetRunMessages": true,
24+
"launchBrowser": true,
25+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
26+
"applicationUrl": "https://localhost:7094;http://localhost:5232",
27+
"environmentVariables": {
28+
"ASPNETCORE_ENVIRONMENT": "Development"
29+
}
30+
},
31+
"IIS Express": {
32+
"commandName": "IISExpress",
33+
"launchBrowser": true,
34+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
35+
"environmentVariables": {
36+
"ASPNETCORE_ENVIRONMENT": "Development"
37+
}
38+
}
39+
}
40+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
6+
</div>
7+
8+
<main>
9+
<div class="top-row px-4">
10+
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
11+
</div>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
17+
</div>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.page {
2+
position: relative;
3+
display: flex;
4+
flex-direction: column;
5+
}
6+
7+
main {
8+
flex: 1;
9+
}
10+
11+
.sidebar {
12+
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13+
}
14+
15+
.top-row {
16+
background-color: #f7f7f7;
17+
border-bottom: 1px solid #d6d5d5;
18+
justify-content: flex-end;
19+
height: 3.5rem;
20+
display: flex;
21+
align-items: center;
22+
}
23+
24+
.top-row ::deep a, .top-row ::deep .btn-link {
25+
white-space: nowrap;
26+
margin-left: 1.5rem;
27+
text-decoration: none;
28+
}
29+
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
35+
overflow: hidden;
36+
text-overflow: ellipsis;
37+
}
38+
39+
@media (max-width: 640.98px) {
40+
.top-row:not(.auth) {
41+
display: none;
42+
}
43+
44+
.top-row.auth {
45+
justify-content: space-between;
46+
}
47+
48+
.top-row ::deep a, .top-row ::deep .btn-link {
49+
margin-left: 0;
50+
}
51+
}
52+
53+
@media (min-width: 641px) {
54+
.page {
55+
flex-direction: row;
56+
}
57+
58+
.sidebar {
59+
width: 250px;
60+
height: 100vh;
61+
position: sticky;
62+
top: 0;
63+
}
64+
65+
.top-row {
66+
position: sticky;
67+
top: 0;
68+
z-index: 1;
69+
}
70+
71+
.top-row.auth ::deep a:first-child {
72+
flex: 1;
73+
text-align: right;
74+
width: 0;
75+
}
76+
77+
.top-row, article {
78+
padding-left: 2rem !important;
79+
padding-right: 1.5rem !important;
80+
}
81+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div class="top-row ps-3 navbar navbar-dark">
2+
<div class="container-fluid">
3+
<a class="navbar-brand" href="">CodeBeam.MudExtensions.UnitTest.Viewer</a>
4+
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
</div>
8+
</div>
9+
10+
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
11+
<nav class="flex-column">
12+
<div 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+
</div>
17+
<div class="nav-item px-3">
18+
<NavLink class="nav-link" href="counter">
19+
<span class="oi oi-plus" aria-hidden="true"></span> Counter
20+
</NavLink>
21+
</div>
22+
<div class="nav-item px-3">
23+
<NavLink class="nav-link" href="fetchdata">
24+
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
25+
</NavLink>
26+
</div>
27+
</nav>
28+
</div>
29+
30+
@code {
31+
private bool collapseNavMenu = true;
32+
33+
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
34+
35+
private void ToggleNavMenu()
36+
{
37+
collapseNavMenu = !collapseNavMenu;
38+
}
39+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.navbar-toggler {
2+
background-color: rgba(255, 255, 255, 0.1);
3+
}
4+
5+
.top-row {
6+
height: 3.5rem;
7+
background-color: rgba(0,0,0,0.4);
8+
}
9+
10+
.navbar-brand {
11+
font-size: 1.1rem;
12+
}
13+
14+
.oi {
15+
width: 2rem;
16+
font-size: 1.1rem;
17+
vertical-align: text-top;
18+
top: -2px;
19+
}
20+
21+
.nav-item {
22+
font-size: 0.9rem;
23+
padding-bottom: 0.5rem;
24+
}
25+
26+
.nav-item:first-of-type {
27+
padding-top: 1rem;
28+
}
29+
30+
.nav-item:last-of-type {
31+
padding-bottom: 1rem;
32+
}
33+
34+
.nav-item ::deep a {
35+
color: #d7d7d7;
36+
border-radius: 4px;
37+
height: 3rem;
38+
display: flex;
39+
align-items: center;
40+
line-height: 3rem;
41+
}
42+
43+
.nav-item ::deep a.active {
44+
background-color: rgba(255,255,255,0.25);
45+
color: white;
46+
}
47+
48+
.nav-item ::deep a:hover {
49+
background-color: rgba(255,255,255,0.1);
50+
color: white;
51+
}
52+
53+
@media (min-width: 641px) {
54+
.navbar-toggler {
55+
display: none;
56+
}
57+
58+
.collapse {
59+
/* Never collapse the sidebar for wide screens */
60+
display: block;
61+
}
62+
63+
.nav-scrollable {
64+
/* Allow sidebar to scroll for tall menus */
65+
height: calc(100vh - 3.5rem);
66+
overflow-y: auto;
67+
}
68+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@namespace CodeBeam.MudExtensions.UnitTests.TestComponents
2+
3+
<MudPaper Width="300px">
4+
<MudListExtended T="int?" Clickable="true" SelectedValueChanged="ValueChanged" SelectedValuesChanged="ValuesChanged" SelectedItemChanged="ItemChanged" SelectedItemsChanged="ItemsChanged">
5+
<MudListItemExtended T="int?" Value="1" Text="Trash" />
6+
<MudListItemExtended T="int?" Value="2" Text="Spam" />
7+
<MudDivider />
8+
<MudListItemExtended T="int?" Value="3" Text="Inbox" Icon="@Icons.Filled.Inbox" />
9+
<MudListItemExtended T="int?" Value="4" Text="Sent" Icon="@Icons.Filled.Send" />
10+
<MudDivider />
11+
<MudListItemExtended T="int?" Value="5" Avatar="@Icons.Filled.Image" IconColor="Color.Primary">Photos</MudListItemExtended>
12+
<MudListItemExtended T="int?" Value="6" Avatar="@Icons.Filled.Work" IconColor="Color.Secondary">Work</MudListItemExtended>
13+
</MudListExtended>
14+
</MudPaper>
15+
16+
@code {
17+
public int ValueChangeCount { get; set; }
18+
public int ValuesChangeCount { get; set; }
19+
public int ItemChangeCount { get; set; }
20+
public int ItemsChangeCount { get; set; }
21+
22+
private void ValueChanged()
23+
{
24+
ValueChangeCount++;
25+
}
26+
27+
private void ValuesChanged()
28+
{
29+
ValuesChangeCount++;
30+
}
31+
32+
private void ItemChanged()
33+
{
34+
ItemChangeCount++;
35+
}
36+
37+
private void ItemsChanged()
38+
{
39+
ItemsChangeCount++;
40+
}
41+
}

0 commit comments

Comments
 (0)