Skip to content

Commit

Permalink
Add mudblazor as first of blazor options
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Dec 28, 2023
1 parent 3e864c7 commit 87cea37
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 6 deletions.
6 changes: 6 additions & 0 deletions ProjectTemplates/ShinyApp/.template.config/ide.host.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,11 @@
"text": "Add EmbedIO Tiny Web Server"
},
"isVisible": true
},{
"id": "mudblazor",
"name":{
"text": "BLAZOR - Add MudBlazor"
},
"isVisible": true
}]
}
12 changes: 9 additions & 3 deletions ProjectTemplates/ShinyApp/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@
"description": "Add EmbedIO Tiny Web Server - Documentation: https://unosquare.github.io/embedio/",
"displayName": "Add EmbedIO Tiny Web Server"
},
"mudblazor": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "BLAZOR - Add MudBlazor",
"displayName": "BLAZOR - Add MudBlazor"
},
"androidauto":{
"type": "parameter",
"datatype": "bool",
Expand Down Expand Up @@ -689,12 +696,11 @@
{
"condition": "(storereview == false)",
"exclude": "Platforms/Android/proguard.cfg"
},
},
{
"condition": "(useblazor == false)",
"exclude":[
"Main.razor",
"_Imports.razor",
"*.razor",
"Pages/**" ,
"Shared/**",
"wwwroot/**"
Expand Down
12 changes: 11 additions & 1 deletion ProjectTemplates/ShinyApp/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Add the following to your XAML declaration
```
<!--#endif-->
<!--#if (embedio)-->
Embed.IO
## Embed.IO

A tiny, cross-platform, module based, MIT-licensed web server for .NET Framework and .NET Core by Unosquare
* Network operations use the async/await pattern: Responses are handled asynchronously
Expand All @@ -268,4 +268,14 @@ A tiny, cross-platform, module based, MIT-licensed web server for .NET Framework
* [Documentation](https://unosquare.github.io/embedio/)
* [GitHub](https://github.com/unosquare/embedio/)

<!--#endif-->
<!--#if (useblazor && mudblazor)-->
## MudBlazor

_The Blazor Component Library You always wanted_

Trusted by thousands of users, from hobby developers to large enterprises. Use MudBlazor to rapidly build amazing web applications without leaving your loved C# language and toolchain.

[Documentation](https://mudblazor.com/)

<!--#endif-->
5 changes: 5 additions & 0 deletions ProjectTemplates/ShinyApp/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!--#if (mudblazor)-->
<MudThemeProvider/>
<MudDialogProvider/>
<MudSnackbarProvider/>
<!--#endif-->
7 changes: 7 additions & 0 deletions ProjectTemplates/ShinyApp/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#if uraniumui
using UraniumUI;
#endif
#if useblazor && mudblazor
using MudBlazor.Services;
#endif

namespace ShinyApp;

Expand Down Expand Up @@ -317,6 +320,10 @@ static MauiAppBuilder RegisterViews(this MauiAppBuilder builder)

#if useblazor
s.AddMauiBlazorWebView();

#if mudblazor
builder.Services.AddMudServices();
#endif
//-:cnd:noEmit
#if DEBUG
s.AddBlazorWebViewDeveloperTools();
Expand Down
3 changes: 3 additions & 0 deletions ProjectTemplates/ShinyApp/ShinyApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@
<!--#if (embedio)-->
<PackageReference Include="EmbedIO" Version="3.5.2" />
<!--#endif-->
<!--#if (useblazor && mudblazor)-->
<PackageReference Include="MudBlazor" Version="6.11.2" />
<!--#endif-->
</ItemGroup>

<!--#if (flipper || useappcenter)-->
Expand Down
4 changes: 3 additions & 1 deletion ProjectTemplates/ShinyApp/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
@using Microsoft.JSInterop
@using ShinyApp
@using ShinyApp.Shared

//#if (mudblazor)
@using MudBlazor
//#endif
8 changes: 7 additions & 1 deletion ProjectTemplates/ShinyApp/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/app.css" rel="stylesheet" />
<link href="ShinyApp.styles.css" rel="stylesheet" />
<!--#if (mudblazor)-->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
<!--#endif-->
</head>

<body>
Expand All @@ -23,7 +27,9 @@
</div>

<script src="_framework/blazor.webview.js" autostart="false"></script>

<!--#if (mudblazor)-->
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
<!--#endif-->
</body>

</html>

0 comments on commit 87cea37

Please sign in to comment.