Skip to content
This repository was archived by the owner on Mar 10, 2024. It is now read-only.

Commit c734eb9

Browse files
committed
Updated to match the .NET 7.0 template
1 parent d8051db commit c734eb9

File tree

5 files changed

+63
-44
lines changed

5 files changed

+63
-44
lines changed

template/BlazorWithIdentity.Client/Shared/MainLayout.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
<NavMenu />
1010
</div>
1111

12-
<div class="main">
12+
<main>
1313
<div class="top-row px-4">
14-
<button type="button" class="btn btn-link ml-md-auto" @onclick="@LogoutClick">Logout</button>
14+
<button type="button" class="btn btn-link" @onclick="@LogoutClick">Logout</button>
1515
</div>
1616

17-
<div class="content px-4">
17+
<article class="content px-4">
1818
@Body
19-
</div>
20-
</div>
19+
</article>
20+
</main>
2121
</Authorized>
2222
<NotAuthorized>
2323
@*Just render the body so that RedirectToLogin works*@
@@ -27,7 +27,7 @@
2727
</div>
2828

2929

30-
@code{
30+
@code {
3131

3232
async Task LogoutClick()
3333
{

template/BlazorWithIdentity.Client/Shared/MainLayout.razor.css

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
flex-direction: column;
55
}
66

7-
.main {
7+
main {
88
flex: 1;
99
}
1010

@@ -21,15 +21,20 @@
2121
align-items: center;
2222
}
2323

24-
.top-row ::deep a, .top-row .btn-link {
24+
.top-row ::deep a, .top-row ::deep .btn-link {
2525
white-space: nowrap;
2626
margin-left: 1.5rem;
27+
text-decoration: none;
2728
}
2829

29-
.top-row a:first-child {
30-
overflow: hidden;
31-
text-overflow: ellipsis;
32-
}
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+
}
3338

3439
@media (max-width: 640.98px) {
3540
.top-row:not(.auth) {
@@ -40,7 +45,7 @@
4045
justify-content: space-between;
4146
}
4247

43-
.top-row a, .top-row .btn-link {
48+
.top-row ::deep a, .top-row ::deep .btn-link {
4449
margin-left: 0;
4550
}
4651
}
@@ -63,7 +68,13 @@
6368
z-index: 1;
6469
}
6570

66-
.main > div {
71+
.top-row.auth ::deep a:first-child {
72+
flex: 1;
73+
text-align: right;
74+
width: 0;
75+
}
76+
77+
.top-row, article {
6778
padding-left: 2rem !important;
6879
padding-right: 1.5rem !important;
6980
}

template/BlazorWithIdentity.Client/Shared/NavMenu.razor

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
<div class="top-row pl-4 navbar navbar-dark">
2-
<a class="navbar-brand" href="">BlazorWithIdentity</a>
3-
<button class="navbar-toggler" @onclick="@ToggleNavMenu">
4-
<span class="navbar-toggler-icon"></span>
5-
</button>
1+
<div class="top-row ps-3 navbar navbar-dark">
2+
<div class="container-fluid">
3+
<a class="navbar-brand" href="">BlazorApp4</a>
4+
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
5+
<span class="navbar-toggler-icon"></span>
6+
</button>
7+
</div>
68
</div>
79

8-
<div class="@NavMenuCssClass" @onclick="@ToggleNavMenu">
9-
<ul class="nav flex-column">
10-
<li class="nav-item px-3">
10+
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
11+
<nav class="flex-column">
12+
<div class="nav-item px-3">
1113
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
1214
<span class="oi oi-home" aria-hidden="true"></span> Home
1315
</NavLink>
14-
</li>
15-
<li class="nav-item px-3">
16+
</div>
17+
<div class="nav-item px-3">
1618
<NavLink class="nav-link" href="counter">
1719
<span class="oi oi-plus" aria-hidden="true"></span> Counter
1820
</NavLink>
19-
</li>
20-
<li class="nav-item px-3">
21+
</div>
22+
<div class="nav-item px-3">
2123
<NavLink class="nav-link" href="fetchdata">
2224
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
2325
</NavLink>
24-
</li>
25-
</ul>
26+
</div>
27+
</nav>
2628
</div>
2729

28-
@functions {
29-
bool collapseNavMenu = true;
30+
@code {
31+
private bool collapseNavMenu = true;
3032

31-
string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
33+
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
3234

33-
void ToggleNavMenu()
35+
private void ToggleNavMenu()
3436
{
3537
collapseNavMenu = !collapseNavMenu;
3638
}

template/BlazorWithIdentity.Client/Shared/NavMenu.razor.css

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
line-height: 3rem;
4141
}
4242

43-
.nav-item ::deep a.active {
44-
background-color: rgba(255,255,255,0.25);
45-
color: white;
46-
}
43+
.nav-item ::deep a.active {
44+
background-color: rgba(255,255,255,0.25);
45+
color: white;
46+
}
4747

48-
.nav-item ::deep a:hover {
49-
background-color: rgba(255,255,255,0.1);
50-
color: white;
51-
}
48+
.nav-item ::deep a:hover {
49+
background-color: rgba(255,255,255,0.1);
50+
color: white;
51+
}
5252

5353
@media (min-width: 641px) {
5454
.navbar-toggler {
@@ -59,4 +59,10 @@
5959
/* Never collapse the sidebar for wide screens */
6060
display: block;
6161
}
62+
63+
.nav-scrollable {
64+
/* Allow sidebar to scroll for tall menus */
65+
height: calc(100vh - 3.5rem);
66+
overflow-y: auto;
67+
}
6268
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
<div class="alert alert-secondary mt-4" role="alert">
2-
<span class="oi oi-pencil mr-2" aria-hidden="true"></span>
1+
<div class="alert alert-secondary mt-4">
2+
<span class="oi oi-pencil me-2" aria-hidden="true"></span>
33
<strong>@Title</strong>
44

55
<span class="text-nowrap">
66
Please take our
7-
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2137916">brief survey</a>
7+
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2186157">brief survey</a>
88
</span>
99
and tell us what you think.
1010
</div>
1111

1212
@code {
1313
// Demonstrates how a parent component can supply parameters
1414
[Parameter]
15-
public string Title { get; set; }
15+
public string? Title { get; set; }
1616
}

0 commit comments

Comments
 (0)