From 0c6ebb6489e202356673f3bf3c3270f84de195b5 Mon Sep 17 00:00:00 2001 From: Rene Bentes Pinto Date: Tue, 22 Oct 2024 22:15:13 -0300 Subject: [PATCH] feat: cria projeto Blazor --- 3002.sln | 27 +++++++++++++ global.json | 6 +++ src/BlazingShop/App.razor | 18 +++++++++ src/BlazingShop/BlazingShop.csproj | 12 ++++++ src/BlazingShop/Error/Error.razor | 36 ++++++++++++++++++ src/BlazingShop/GlobalUsings.cs | 1 + src/BlazingShop/Home/Home.razor | 7 ++++ src/BlazingShop/Layouts/MainLayout.razor | 9 +++++ src/BlazingShop/Layouts/MainLayout.razor.css | 18 +++++++++ src/BlazingShop/Program.cs | 26 +++++++++++++ .../Properties/launchSettings.json | 38 +++++++++++++++++++ src/BlazingShop/Routes.razor | 6 +++ src/BlazingShop/_Imports.razor | 10 +++++ src/BlazingShop/appsettings.Development.json | 8 ++++ src/BlazingShop/appsettings.json | 9 +++++ src/BlazingShop/wwwroot/app.css | 29 ++++++++++++++ 16 files changed, 260 insertions(+) create mode 100644 3002.sln create mode 100644 global.json create mode 100644 src/BlazingShop/App.razor create mode 100644 src/BlazingShop/BlazingShop.csproj create mode 100644 src/BlazingShop/Error/Error.razor create mode 100644 src/BlazingShop/GlobalUsings.cs create mode 100644 src/BlazingShop/Home/Home.razor create mode 100644 src/BlazingShop/Layouts/MainLayout.razor create mode 100644 src/BlazingShop/Layouts/MainLayout.razor.css create mode 100644 src/BlazingShop/Program.cs create mode 100644 src/BlazingShop/Properties/launchSettings.json create mode 100644 src/BlazingShop/Routes.razor create mode 100644 src/BlazingShop/_Imports.razor create mode 100644 src/BlazingShop/appsettings.Development.json create mode 100644 src/BlazingShop/appsettings.json create mode 100644 src/BlazingShop/wwwroot/app.css diff --git a/3002.sln b/3002.sln new file mode 100644 index 0000000..83af139 --- /dev/null +++ b/3002.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35417.141 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazingShop", "src\BlazingShop\BlazingShop.csproj", "{49F16CD9-568F-41C0-9A0B-4E438CFD6B5B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77855DCB-A2C5-41B2-A93C-C20CCBC2208E}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {49F16CD9-568F-41C0-9A0B-4E438CFD6B5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {49F16CD9-568F-41C0-9A0B-4E438CFD6B5B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49F16CD9-568F-41C0-9A0B-4E438CFD6B5B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {49F16CD9-568F-41C0-9A0B-4E438CFD6B5B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/global.json b/global.json new file mode 100644 index 0000000..eead6b0 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "rollForward": "latestFeature", + "version": "8.0.x" + } +} \ No newline at end of file diff --git a/src/BlazingShop/App.razor b/src/BlazingShop/App.razor new file mode 100644 index 0000000..cf1a352 --- /dev/null +++ b/src/BlazingShop/App.razor @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/BlazingShop/BlazingShop.csproj b/src/BlazingShop/BlazingShop.csproj new file mode 100644 index 0000000..0311545 --- /dev/null +++ b/src/BlazingShop/BlazingShop.csproj @@ -0,0 +1,12 @@ + + + + net8.0 + enable + enable + + + + + + diff --git a/src/BlazingShop/Error/Error.razor b/src/BlazingShop/Error/Error.razor new file mode 100644 index 0000000..576cc2d --- /dev/null +++ b/src/BlazingShop/Error/Error.razor @@ -0,0 +1,36 @@ +@page "/Error" +@using System.Diagnostics + +Error + +

Error.

+

An error occurred while processing your request.

+ +@if (ShowRequestId) +{ +

+ Request ID: @RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+ +@code{ + [CascadingParameter] + private HttpContext? HttpContext { get; set; } + + private string? RequestId { get; set; } + private bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + protected override void OnInitialized() => + RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier; +} diff --git a/src/BlazingShop/GlobalUsings.cs b/src/BlazingShop/GlobalUsings.cs new file mode 100644 index 0000000..7698cea --- /dev/null +++ b/src/BlazingShop/GlobalUsings.cs @@ -0,0 +1 @@ +global using BlazingShop; diff --git a/src/BlazingShop/Home/Home.razor b/src/BlazingShop/Home/Home.razor new file mode 100644 index 0000000..9001e0b --- /dev/null +++ b/src/BlazingShop/Home/Home.razor @@ -0,0 +1,7 @@ +@page "/" + +Home + +

Hello, world!

+ +Welcome to your new app. diff --git a/src/BlazingShop/Layouts/MainLayout.razor b/src/BlazingShop/Layouts/MainLayout.razor new file mode 100644 index 0000000..0fd1b20 --- /dev/null +++ b/src/BlazingShop/Layouts/MainLayout.razor @@ -0,0 +1,9 @@ +@inherits LayoutComponentBase + +@Body + +
+ An unhandled error has occurred. + Reload + 🗙 +
diff --git a/src/BlazingShop/Layouts/MainLayout.razor.css b/src/BlazingShop/Layouts/MainLayout.razor.css new file mode 100644 index 0000000..df8c10f --- /dev/null +++ b/src/BlazingShop/Layouts/MainLayout.razor.css @@ -0,0 +1,18 @@ +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + + #blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; + } diff --git a/src/BlazingShop/Program.cs b/src/BlazingShop/Program.cs new file mode 100644 index 0000000..3c51d67 --- /dev/null +++ b/src/BlazingShop/Program.cs @@ -0,0 +1,26 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services + .AddRazorComponents() + .AddInteractiveServerComponents(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/error", createScopeForErrors: true); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); + +app.UseStaticFiles(); +app.UseAntiforgery(); + +app.MapRazorComponents() + .AddInteractiveServerRenderMode(); + +app.Run(); diff --git a/src/BlazingShop/Properties/launchSettings.json b/src/BlazingShop/Properties/launchSettings.json new file mode 100644 index 0000000..f75a03a --- /dev/null +++ b/src/BlazingShop/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:7576", + "sslPort": 44372 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5075", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7233;http://localhost:5075", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } + } diff --git a/src/BlazingShop/Routes.razor b/src/BlazingShop/Routes.razor new file mode 100644 index 0000000..fcd6159 --- /dev/null +++ b/src/BlazingShop/Routes.razor @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/BlazingShop/_Imports.razor b/src/BlazingShop/_Imports.razor new file mode 100644 index 0000000..96a830d --- /dev/null +++ b/src/BlazingShop/_Imports.razor @@ -0,0 +1,10 @@ +@using BlazingShop +@using BlazingShop.Layouts +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using System.Net.Http +@using System.Net.Http.Json diff --git a/src/BlazingShop/appsettings.Development.json b/src/BlazingShop/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/BlazingShop/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/BlazingShop/appsettings.json b/src/BlazingShop/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/BlazingShop/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/BlazingShop/wwwroot/app.css b/src/BlazingShop/wwwroot/app.css new file mode 100644 index 0000000..e398853 --- /dev/null +++ b/src/BlazingShop/wwwroot/app.css @@ -0,0 +1,29 @@ +h1:focus { + outline: none; +} + +.valid.modified:not([type=checkbox]) { + outline: 1px solid #26b050; +} + +.invalid { + outline: 1px solid #e50000; +} + +.validation-message { + color: #e50000; +} + +.blazor-error-boundary { + background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDki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jEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; + padding: 1rem 1rem 1rem 3.7rem; + color: white; +} + + .blazor-error-boundary::after { + content: "An error has occurred." + } + +.darker-border-checkbox.form-check-input { + border-color: #929292; +}