Skip to content

Commit d2716fe

Browse files
Updated sample projects
- Added a new solution file for the samples - Converted MiniExcel.Samples.AspNetCore project to a minimal apis project and renamed it to MiniExcel.Samples.MinimalApis - Added a MiniExcel.Samples.Blazor sample project - Added a MiniExcel.Samples.FileBasedApp sample file - Unrelated minor changes: moved icon.png from src folder to docs folder, moved some editorconfig lines to a more specific editorconfig in the src folder, removed redundant System.IO.Compression package reference from Directory.Packages.props
1 parent c452533 commit d2716fe

39 files changed

+1049
-226
lines changed

.editorconfig

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,5 @@ dotnet_style_qualification_for_method = false
1515
# IDE0065: Misplaced using directive
1616
csharp_using_directive_placement = outside_namespace
1717

18-
# CA1835: Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes
19-
dotnet_diagnostic.CA1835.severity = error
20-
21-
# CA1849: Call async methods when in an async method
22-
dotnet_diagnostic.CA1849.severity = error
23-
24-
dotnet_diagnostic.CA2000.severity = error
25-
26-
# CA2007: Do not directly await a Task
27-
dotnet_diagnostic.CA2007.severity = error
28-
29-
# CA2016: Forward the CancellationToken parameter to methods that take one
30-
dotnet_diagnostic.CA2016.severity = error
31-
18+
# IDE0161: Use file-scoped namespace
3219
csharp_style_namespace_declarations = file_scoped:silent
File renamed without changes.

samples/MiniExcel.Samples.AspNetCore/MiniExcel.Samples.AspNetCore.csproj

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

samples/MiniExcel.Samples.AspNetCore/MiniExcel.Samples.AspNetCore.sln

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

samples/MiniExcel.Samples.AspNetCore/Program.cs

Lines changed: 0 additions & 160 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
<ResourcePreloader/>
9+
<link rel="stylesheet" href="@Assets["lib/bootstrap/bootstrap.min.css"]"/>
10+
<link rel="stylesheet" href="@Assets["app.css"]"/>
11+
<link rel="stylesheet" href="@Assets["MiniExcel.Samples.Blazor.styles.css"]"/>
12+
<ImportMap/>
13+
<link rel="icon" type="image/png" href="favicon.png"/>
14+
<HeadOutlet @rendermode="InteractiveServer"/>
15+
</head>
16+
17+
<body>
18+
<Routes @rendermode="InteractiveServer"/>
19+
<ReconnectModal/>
20+
<script src="@Assets["_framework/blazor.web.js"]"></script>
21+
22+
<script>
23+
downloadFileFromStream = async (fileName, contentStreamReference) => {
24+
const arrayBuffer = await contentStreamReference.arrayBuffer();
25+
const blob = new Blob([arrayBuffer]);
26+
const url = URL.createObjectURL(blob);
27+
const anchorElement = document.createElement('a');
28+
anchorElement.href = url;
29+
anchorElement.download = fileName ?? '';
30+
anchorElement.click();
31+
anchorElement.remove();
32+
URL.revokeObjectURL(url);
33+
}
34+
</script>
35+
</body>
36+
37+
</html>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu/>
6+
</div>
7+
8+
<main>
9+
<article class="content px-4">
10+
@Body
11+
</article>
12+
</main>
13+
</div>
14+
15+
<div id="blazor-error-ui" data-nosnippet>
16+
An unhandled error has occurred.
17+
<a href="." class="reload">Reload</a>
18+
<span class="dismiss">🗙</span>
19+
</div>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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 {
41+
justify-content: space-between;
42+
}
43+
44+
.top-row ::deep a, .top-row ::deep .btn-link {
45+
margin-left: 0;
46+
}
47+
}
48+
49+
@media (min-width: 641px) {
50+
.page {
51+
flex-direction: row;
52+
}
53+
54+
.sidebar {
55+
width: 250px;
56+
height: 100vh;
57+
position: sticky;
58+
top: 0;
59+
}
60+
61+
.top-row {
62+
position: sticky;
63+
top: 0;
64+
z-index: 1;
65+
}
66+
67+
.top-row.auth ::deep a:first-child {
68+
flex: 1;
69+
text-align: right;
70+
width: 0;
71+
}
72+
73+
.top-row, article {
74+
padding-left: 2rem !important;
75+
padding-right: 1.5rem !important;
76+
}
77+
}
78+
79+
#blazor-error-ui {
80+
color-scheme: light only;
81+
background: lightyellow;
82+
bottom: 0;
83+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
84+
box-sizing: border-box;
85+
display: none;
86+
left: 0;
87+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
88+
position: fixed;
89+
width: 100%;
90+
z-index: 1000;
91+
}
92+
93+
#blazor-error-ui .dismiss {
94+
cursor: pointer;
95+
position: absolute;
96+
right: 0.75rem;
97+
top: 0.5rem;
98+
}

0 commit comments

Comments
 (0)