From 5753246065899aabdc2d47fd969a089ed4fd01c0 Mon Sep 17 00:00:00 2001 From: Peace Date: Fri, 5 Jul 2024 17:42:51 +0900 Subject: [PATCH] layout --- .dockerignore | 30 ++++++++ BlazorFluentUI/.config/dotnet-tools.json | 13 ++++ BlazorFluentUI/BlazorFluentUI.csproj | 3 + .../Components/Layout/MainLayout.razor | 28 +++++-- .../Components/Layout/NavMenu.razor | 1 + BlazorFluentUI/Components/Pages/Home.razor | 2 +- .../Components/Pages/LayoutLayout.razor | 68 +++++++++++++++++ BlazorFluentUI/Dockerfile | 25 +++++++ BlazorFluentUI/Properties/launchSettings.json | 75 +++++++++++-------- 9 files changed, 206 insertions(+), 39 deletions(-) create mode 100644 .dockerignore create mode 100644 BlazorFluentUI/.config/dotnet-tools.json create mode 100644 BlazorFluentUI/Components/Pages/LayoutLayout.razor create mode 100644 BlazorFluentUI/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,30 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/BlazorFluentUI/.config/dotnet-tools.json b/BlazorFluentUI/.config/dotnet-tools.json new file mode 100644 index 0000000..4f257cf --- /dev/null +++ b/BlazorFluentUI/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "8.0.6", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/BlazorFluentUI/BlazorFluentUI.csproj b/BlazorFluentUI/BlazorFluentUI.csproj index aeffd0a..2e9da47 100644 --- a/BlazorFluentUI/BlazorFluentUI.csproj +++ b/BlazorFluentUI/BlazorFluentUI.csproj @@ -4,11 +4,14 @@ net8.0 enable enable + a4f1c096-eec4-4f90-9505-558f2f4be683 + Linux + diff --git a/BlazorFluentUI/Components/Layout/MainLayout.razor b/BlazorFluentUI/Components/Layout/MainLayout.razor index cc5a1a8..4800e57 100644 --- a/BlazorFluentUI/Components/Layout/MainLayout.razor +++ b/BlazorFluentUI/Components/Layout/MainLayout.razor @@ -1,16 +1,13 @@ @inherits LayoutComponentBase - - - - +@inject IHostEnvironment HostEnvironment BlazorFluentUI - + @* *@
@@ -27,8 +24,27 @@ -
+ + + + + + +@*
An unhandled error has occurred. Reload 🗙 +
*@ + +
+ @if (HostEnvironment.IsProduction()) + { + An error has occurred. + } + else + { + An unhandled exception occurred. + } + Reload + 🗙
diff --git a/BlazorFluentUI/Components/Layout/NavMenu.razor b/BlazorFluentUI/Components/Layout/NavMenu.razor index 2cba721..ff98319 100644 --- a/BlazorFluentUI/Components/Layout/NavMenu.razor +++ b/BlazorFluentUI/Components/Layout/NavMenu.razor @@ -15,6 +15,7 @@ Footer BodyContent Grid + Layout diff --git a/BlazorFluentUI/Components/Pages/Home.razor b/BlazorFluentUI/Components/Pages/Home.razor index d373d0c..cac4954 100644 --- a/BlazorFluentUI/Components/Pages/Home.razor +++ b/BlazorFluentUI/Components/Pages/Home.razor @@ -4,7 +4,7 @@ Home - +

Hello Fluent UI!

diff --git a/BlazorFluentUI/Components/Pages/LayoutLayout.razor b/BlazorFluentUI/Components/Pages/LayoutLayout.razor new file mode 100644 index 0000000..9bd3776 --- /dev/null +++ b/BlazorFluentUI/Components/Pages/LayoutLayout.razor @@ -0,0 +1,68 @@ +@page "/layoutlayout" + +@rendermode RenderMode.InteractiveServer + +Layout + + + The FluentLayout component is a container for other components. + + + + Header + NavMenu + BodyContent + Footer + + + @if (showHeader) + { + + Header text + + Aligned to the end + + } + + + @if (showNavMenu) + { + + Item 1 + Item 2 + + Item 3.1 + Item 3.2 + + Item 4 + + } + + @if (showBodyContent) + { + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce quis lorem lacus. + Ut id leo non enim feugiat ultrices. Proin vulputate volutpat urna nec iaculis. + Integer dui lacus, fermentum sit amet aliquet in, scelerisque vitae dui. + Nulla fringilla sagittis orci eu consectetur. Fusce eget dolor non lectus placerat + + } + + + @if (showFooter) + { + + Footer text + + Aligned to the end + + } + + + +@code { + bool showHeader = true; + bool showNavMenu = true; + bool showBodyContent = true; + bool showFooter = true; +} diff --git a/BlazorFluentUI/Dockerfile b/BlazorFluentUI/Dockerfile new file mode 100644 index 0000000..ecb720f --- /dev/null +++ b/BlazorFluentUI/Dockerfile @@ -0,0 +1,25 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER app +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["BlazorFluentUI/BlazorFluentUI.csproj", "BlazorFluentUI/"] +RUN dotnet restore "./BlazorFluentUI/BlazorFluentUI.csproj" +COPY . . +WORKDIR "/src/BlazorFluentUI" +RUN dotnet build "./BlazorFluentUI.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./BlazorFluentUI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "BlazorFluentUI.dll"] \ No newline at end of file diff --git a/BlazorFluentUI/Properties/launchSettings.json b/BlazorFluentUI/Properties/launchSettings.json index 2e0b35f..494dcdf 100644 --- a/BlazorFluentUI/Properties/launchSettings.json +++ b/BlazorFluentUI/Properties/launchSettings.json @@ -1,38 +1,49 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:41550", - "sslPort": 44309 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "http://localhost:5231", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:7166;http://localhost:5231", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5231" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7166;http://localhost:5231" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:41550", + "sslPort": 44309 } } +} \ No newline at end of file