Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to .net 6 #359

Merged
merged 5 commits into from
Mar 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [published]

env:
NETCORE_VERSION: "5.0.102"
NETCORE_VERSION: "6.0.x"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
PROJECT_NAME: Modal
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Rewrite base href
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1
with:
html_path: samples/BlazorWebAssembly/bin/Release/net5.0/publish/wwwroot/index.html
html_path: samples/BlazorWebAssembly/bin/Release/net6.0/publish/wwwroot/index.html
base_href: /${{ env.PROJECT_NAME }}/

- name: Deploy to Github Pages
Expand All @@ -59,7 +59,7 @@ jobs:
ACCESS_TOKEN: $GITHUB_TOKEN
BASE_BRANCH: main # The branch the action should deploy from.
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: samples/BlazorWebAssembly/bin/Release/net5.0/publish/wwwroot # The folder the action should deploy.
FOLDER: samples/BlazorWebAssembly/bin/Release/net6.0/publish/wwwroot # The folder the action should deploy.
SINGLE_COMMIT: true

- name: Upload Artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

env:
PROJECT_NAME: Blazored.Modal
NETCORE_VERSION: '5.0.102'
NETCORE_VERSION: '6.0.x'

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Custom rules
src/Blazored.Modal/wwwroot/*.js
src/Blazored.Modal/wwwroot/*.map
.DS_Store

# User-specific files
*.suo
Expand Down
3 changes: 3 additions & 0 deletions Blazored.Modal.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E8AD9151-AB7E-4531-A1DF-8952B1D5580D}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
.gitignore = .gitignore
.github\workflows\ci-main.yml = .github\workflows\ci-main.yml
.github\workflows\ci-pr.yml = .github\workflows\ci-pr.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{DF45C5D5-16E0-47FC-A764-08ED8AF713E2}"
Expand Down
Binary file added samples/.DS_Store
Binary file not shown.
Binary file added samples/BlazorServer/.DS_Store
Binary file not shown.
14 changes: 7 additions & 7 deletions samples/BlazorServer/App.razor
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<CascadingBlazoredModal>
<Router AppAssembly="@typeof(Program).Assembly">
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
</Found>
<NotFound>
<CascadingAuthenticationState>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</CascadingAuthenticationState>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</CascadingBlazoredModal>
4 changes: 3 additions & 1 deletion samples/BlazorServer/BlazorServer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions samples/BlazorServer/Pages/Animation.razor
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
</div>
</div>

<input type="number" @bind-value="@duration" />
<input type="number" @bind-value="@_duration" />

<button @onclick="@(() => AnimationCustom(ModalAnimation.FadeIn(duration)))" class="btn btn-secondary">Fade-In</button>
<button @onclick="@(() => AnimationCustom(ModalAnimation.FadeOut(duration)))" class="btn btn-secondary">Fade-Out</button>
<button @onclick="@(() => AnimationCustom(ModalAnimation.FadeIn(_duration)))" class="btn btn-secondary">Fade-In</button>
<button @onclick="@(() => AnimationCustom(ModalAnimation.FadeOut(_duration)))" class="btn btn-secondary">Fade-Out</button>
<button @onclick="AnimationDefault" class="btn btn-primary">Globally set value (default no animation)</button>
<button @onclick="@(() => AnimationCustom(ModalAnimation.FadeInOut(duration)))" class="btn btn-secondary">Fade-in Fade-Out</button>
<button @onclick="@(() => AnimationCustom(ModalAnimation.FadeInOut(_duration)))" class="btn btn-secondary">Fade-in Fade-Out</button>

<p>
It is also possible to have multiple modals (like in the Multiple Modals example) with different animations. With the below modal, the first modal will only fade-in with a duration of 2 seconds. The second modal will fade-in and fade-out in 5.0 seconds.
Expand All @@ -47,9 +47,9 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

private double duration = 1.0;
private double _duration = 1.0;

void AnimationDefault()
{
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorServer/Pages/BackgroundCancel.razor
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void BackgroundCancelEnabled()
{
Expand Down
5 changes: 2 additions & 3 deletions samples/BlazorServer/Pages/CustomLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void ShowModalCustomLayout()
{
var options = new ModalOptions { UseCustomLayout = true };
var parameters = new ModalParameters();
parameters.Add(nameof(CustomBootstrapModal.Message), "Hello custom modal!!");
var parameters = new ModalParameters {{nameof(CustomBootstrapModal.Message), "Hello custom modal!!"}};
Modal.Show<CustomBootstrapModal>("Custom Layout", parameters, options);
}

Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorServer/Pages/CustomOverlay.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void ShowModalCustomOverlay()
{
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorServer/Pages/CustomStyle.razor
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void ShowModalCustomStyle()
{
Expand Down
42 changes: 42 additions & 0 deletions samples/BlazorServer/Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page
@model BlazorServer.Pages.ErrorModel

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>

<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>

</html>
26 changes: 26 additions & 0 deletions samples/BlazorServer/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace BlazorServer.Pages;

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
2 changes: 1 addition & 1 deletion samples/BlazorServer/Pages/HideCloseButton.razor
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void CloseButtonShown()
{
Expand Down
4 changes: 3 additions & 1 deletion samples/BlazorServer/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@page "/"

<PageTitle>Blazored Modal Samples</PageTitle>

<h1>Blazored Modal Sample</h1>

<hr class="mb-5" />
Expand All @@ -22,7 +24,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void ShowModal() => Modal.Show<Confirm>("Welcome to Blazored Modal");

Expand Down
8 changes: 4 additions & 4 deletions samples/BlazorServer/Pages/LongRunningTask.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

string _result;
string? _result;

async Task ShowModal()
{
Expand All @@ -48,7 +48,7 @@

loading.Close();
var result = await loading.Result;
if (result.Data == null && result.DataType == typeof(object))
if (result.DataType == typeof(object))
_result = "Modal returned with default ModalResult";

StateHasChanged();
Expand All @@ -69,7 +69,7 @@
loading.Close(ModalResult.Ok("Closed with OK result"));
var result = await loading.Result;
if (result.DataType == typeof(string))
_result = result.Data.ToString();
_result = result.Data.ToString()!;

StateHasChanged();
}
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorServer/Pages/MultipleModals.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void ShowModal() => Modal.Show<YesNoPrompt>("First Modal");

Expand Down
4 changes: 2 additions & 2 deletions samples/BlazorServer/Pages/PassDataToModal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

string _message;
string _message = "";

void ShowModal()
{
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorServer/Pages/Position.razor
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void PositionCenter()
{
Expand Down
4 changes: 2 additions & 2 deletions samples/BlazorServer/Pages/ReturnDataFromModal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

string _message;
string? _message;

async Task ShowModal()
{
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorServer/Pages/ScrollableContent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

@code {

[CascadingParameter] public IModalService Modal { get; set; }
[CascadingParameter] public IModalService Modal { get; set; } = default!;

void ContentScrollableEnabled()
{
Expand Down
29 changes: 4 additions & 25 deletions samples/BlazorServer/Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
@page "/"
@namespace BlazorServer.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Blazored Modal (Server)</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="_content/Blazored.Modal/blazored-modal.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
</head>
<body>
<app>
@(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
</app>

<script type="text/javascript">
if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
document.write('<script src="js/blazor.polyfill.min.js"><\/script>');
}
</script>
<script src="_framework/blazor.server.js"></script>
<script src="_content/Blazored.Modal/blazored.modal.js"></script>
</body>
</html>
<component type="typeof(App)" render-mode="ServerPrerendered" />
Loading