Skip to content

Commit f6fc84b

Browse files
committed
982744: GitHub Sample updated from .net7 to .net8.
1 parent c845502 commit f6fc84b

39 files changed

+391
-1290
lines changed

App.razor

Lines changed: 0 additions & 12 deletions
This file was deleted.

Components/App.razor

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
9+
<link rel="stylesheet" href="app.css" />
10+
<link rel="stylesheet" href="DataGridGettingStartedSample.styles.css" />
11+
<link rel="icon" type="image/png" href="favicon.png" />
12+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
13+
<HeadOutlet @rendermode="InteractiveServer" />
14+
</head>
15+
16+
<body>
17+
<Routes @rendermode="InteractiveServer" />
18+
<script src="_framework/blazor.web.js"></script>
19+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
20+
</body>
21+
22+
</html>
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
@inherits LayoutComponentBase
22

3-
<PageTitle>DataGridGettingStartedSample</PageTitle>
4-
53
<div class="page">
64
<div class="sidebar">
75
<NavMenu />
86
</div>
97

108
<main>
119
<div class="top-row px-4">
12-
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
10+
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
1311
</div>
1412

1513
<article class="content px-4">
1614
@Body
1715
</article>
1816
</main>
1917
</div>
18+
19+
<div id="blazor-error-ui">
20+
An unhandled error has occurred.
21+
<a href="" class="reload">Reload</a>
22+
<a class="dismiss">🗙</a>
23+
</div>

Shared/MainLayout.razor.css renamed to Components/Layout/MainLayout.razor.css

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,27 @@ main {
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+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
3035
overflow: hidden;
3136
text-overflow: ellipsis;
3237
}
3338

3439
@media (max-width: 640.98px) {
35-
.top-row:not(.auth) {
36-
display: none;
37-
}
38-
39-
.top-row.auth {
40+
.top-row {
4041
justify-content: space-between;
4142
}
4243

43-
.top-row a, .top-row .btn-link {
44+
.top-row ::deep a, .top-row ::deep .btn-link {
4445
margin-left: 0;
4546
}
4647
}
@@ -63,8 +64,33 @@ main {
6364
z-index: 1;
6465
}
6566

67+
.top-row.auth ::deep a:first-child {
68+
flex: 1;
69+
text-align: right;
70+
width: 0;
71+
}
72+
6673
.top-row, article {
6774
padding-left: 2rem !important;
6875
padding-right: 1.5rem !important;
6976
}
7077
}
78+
79+
#blazor-error-ui {
80+
background: lightyellow;
81+
bottom: 0;
82+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
83+
display: none;
84+
left: 0;
85+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
86+
position: fixed;
87+
width: 100%;
88+
z-index: 1000;
89+
}
90+
91+
#blazor-error-ui .dismiss {
92+
cursor: pointer;
93+
position: absolute;
94+
right: 0.75rem;
95+
top: 0.5rem;
96+
}

Components/Layout/NavMenu.razor

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<div class="top-row ps-3 navbar navbar-dark">
2+
<div class="container-fluid">
3+
<a class="navbar-brand" href="">DataGridGettingStartedSample</a>
4+
</div>
5+
</div>
6+
7+
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
8+
9+
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
10+
<nav class="flex-column">
11+
<div class="nav-item px-3">
12+
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
13+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
14+
</NavLink>
15+
</div>
16+
17+
<div class="nav-item px-3">
18+
<NavLink class="nav-link" href="counter">
19+
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
20+
</NavLink>
21+
</div>
22+
23+
<div class="nav-item px-3">
24+
<NavLink class="nav-link" href="weather">
25+
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
26+
</NavLink>
27+
</div>
28+
</nav>
29+
</div>
30+
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
.navbar-toggler {
2+
appearance: none;
3+
cursor: pointer;
4+
width: 3.5rem;
5+
height: 2.5rem;
6+
color: white;
7+
position: absolute;
8+
top: 0.5rem;
9+
right: 1rem;
10+
border: 1px solid rgba(255, 255, 255, 0.1);
11+
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
12+
}
13+
14+
.navbar-toggler:checked {
15+
background-color: rgba(255, 255, 255, 0.5);
16+
}
17+
18+
.top-row {
19+
height: 3.5rem;
20+
background-color: rgba(0,0,0,0.4);
21+
}
22+
23+
.navbar-brand {
24+
font-size: 1.1rem;
25+
}
26+
27+
.bi {
28+
display: inline-block;
29+
position: relative;
30+
width: 1.25rem;
31+
height: 1.25rem;
32+
margin-right: 0.75rem;
33+
top: -1px;
34+
background-size: cover;
35+
}
36+
37+
.bi-house-door-fill-nav-menu {
38+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
39+
}
40+
41+
.bi-plus-square-fill-nav-menu {
42+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
43+
}
44+
45+
.bi-list-nested-nav-menu {
46+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
47+
}
48+
49+
.nav-item {
50+
font-size: 0.9rem;
51+
padding-bottom: 0.5rem;
52+
}
53+
54+
.nav-item:first-of-type {
55+
padding-top: 1rem;
56+
}
57+
58+
.nav-item:last-of-type {
59+
padding-bottom: 1rem;
60+
}
61+
62+
.nav-item ::deep .nav-link {
63+
color: #d7d7d7;
64+
background: none;
65+
border: none;
66+
border-radius: 4px;
67+
height: 3rem;
68+
display: flex;
69+
align-items: center;
70+
line-height: 3rem;
71+
width: 100%;
72+
}
73+
74+
.nav-item ::deep a.active {
75+
background-color: rgba(255,255,255,0.37);
76+
color: white;
77+
}
78+
79+
.nav-item ::deep .nav-link:hover {
80+
background-color: rgba(255,255,255,0.1);
81+
color: white;
82+
}
83+
84+
.nav-scrollable {
85+
display: none;
86+
}
87+
88+
.navbar-toggler:checked ~ .nav-scrollable {
89+
display: block;
90+
}
91+
92+
@media (min-width: 641px) {
93+
.navbar-toggler {
94+
display: none;
95+
}
96+
97+
.nav-scrollable {
98+
/* Never collapse the sidebar for wide screens */
99+
display: block;
100+
101+
/* Allow sidebar to scroll for tall menus */
102+
height: calc(100vh - 3.5rem);
103+
overflow-y: auto;
104+
}
105+
}
File renamed without changes.

Components/Pages/Error.razor

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@page "/Error"
2+
@using System.Diagnostics
3+
4+
<PageTitle>Error</PageTitle>
5+
6+
<h1 class="text-danger">Error.</h1>
7+
<h2 class="text-danger">An error occurred while processing your request.</h2>
8+
9+
@if (ShowRequestId)
10+
{
11+
<p>
12+
<strong>Request ID:</strong> <code>@RequestId</code>
13+
</p>
14+
}
15+
16+
<h3>Development Mode</h3>
17+
<p>
18+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
19+
</p>
20+
<p>
21+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
22+
It can result in displaying sensitive information from exceptions to end users.
23+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
24+
and restarting the app.
25+
</p>
26+
27+
@code{
28+
[CascadingParameter]
29+
private HttpContext? HttpContext { get; set; }
30+
31+
private string? RequestId { get; set; }
32+
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
33+
34+
protected override void OnInitialized() =>
35+
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
36+
}

Components/Pages/Home.razor

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@page "/"
2+
3+
<SfGrid DataSource="@Orders" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="true">
4+
<GridPageSettings PageSize="10"></GridPageSettings>
5+
<GridColumns>
6+
<GridColumn Field="@nameof(Order.OrderID)" HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
7+
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
8+
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
9+
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
10+
</GridColumns>
11+
</SfGrid>
12+
13+
@code {
14+
15+
public List<Order>? Orders { get; set; }
16+
17+
protected override void OnInitialized ()
18+
{
19+
Orders = Enumerable.Range(1, 75).Select(x => new Order()
20+
{
21+
OrderID = 1000 + x,
22+
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
23+
Freight = 2.1 * x,
24+
OrderDate = DateTime.Now.AddDays(-x)
25+
}).ToList();
26+
base.OnInitialized();
27+
}
28+
public class Order
29+
{
30+
public int? OrderID { get; set; }
31+
public string? CustomerID { get; set; }
32+
public DateTime? OrderDate { get; set; }
33+
public double? Freight { get; set; }
34+
}
35+
}

0 commit comments

Comments
 (0)