Skip to content

Commit

Permalink
⬆ : upgrade Masa.Blazor to 1.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem committed Jul 20, 2024
1 parent 932e22f commit f9f4d47
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/MASA.OfficialWebsite.WebApp/Components/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Routes />

<script src="_framework/blazor.web.js"></script>
<script src="_content/BlazorComponent/js/blazor-component.js"></script>
<script src="_content/Masa.Blazor/js/masa-blazor.js"></script>
<script src="js/shared.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.2.0/swiper-bundle.min.js"></script>
</body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<AppBar Class="hidden-sm-and-down" BarHeight="100" LogoHeight="42">
@inject NavigationManager NavigationManager

<AppBar Class="hidden-sm-and-down" BarHeight="100" LogoHeight="42">
<SectionOutlet SectionName="document" />

<MInteractiveTriggers Class="nav-menus"
Expand All @@ -11,7 +13,10 @@
InteractiveValue="navMenuInteractiveValues"
InteractiveComponentType="typeof(NavMenu)"
InteractiveComponentParameters="ProductNavMenuParameters">
<MButton Id="@($"{context}-nav-menu")" Class="mr-9 h8 emphasis2--text" Text>
<MButton Id="@($"{context}-nav-menu")"
Class="mr-9 h8 emphasis2--text"
Text
Color="@IsActive(context)">
@(context switch
{
"product" => "产品",
Expand All @@ -21,7 +26,8 @@
</MButton>
</MInteractiveTriggers>

<MButton Text Class="h8 emphasis2--text" Href="/aboutus">
<MButton Text Class="h8 emphasis2--text" Href="/aboutus"
Color="@IsActive("aboutus")">
关于我们
</MButton>
</AppBar>
Expand All @@ -35,6 +41,8 @@
[SupplyParameterFromQuery(Name = "nav-menu")]
private string? QueryValue { get; set; }

private string? _absolutePath;

private static string[] navMenuInteractiveValues = { "product", "study" };

private bool IsProductNavMenu => QueryValue?.Equals("product", StringComparison.OrdinalIgnoreCase) is true;
Expand All @@ -46,4 +54,22 @@

private int NavMenuLeft => IsProductNavMenu ? -388 : -286;

protected override void OnInitialized()
{
_absolutePath = NavigationManager.GetAbsolutePath();
}

private string? IsActive(string context)
{
var trimAbsolutePath = _absolutePath?.Trim('/');

if ((context is "product" && trimAbsolutePath is "stack")
|| (context is "study" && trimAbsolutePath is "learningpath" or "activity")
|| (context is "aboutus" && trimAbsolutePath is "aboutus"))
{
return "primary";
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@

[Parameter] [EditorRequired] public string Image { get; set; } = null!;

[Parameter] public string? Style { get; set; }

[Parameter] public string? Class { get; set; }

}
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@
[
new NavItem("学习中心"),
new NavItem("学习路径", "", "https://cdn.masastack.com/images/bule-dot.svg", "/learningpath", 12),
new NavItem("社区活动", "", "https://cdn.masastack.com/images/bule-dot.svg", "/activity", 12),
new NavItem("博客站点", "", "https://cdn.masastack.com/images/bule-dot.svg", "https://blogs.masastack.com", 12),
new NavItem("文档站点", "", "https://cdn.masastack.com/images/bule-dot.svg", "https://docs.masastack.com", 12),
new NavItem("社区活动", "", "https://cdn.masastack.com/images/bule-dot.svg", "/activity", 12)
];

private static readonly List<NavItem> aboutUsItems =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Href="https://docs.masastack.com/blazor/getting-started/installation"
Target="_blank">
文档
<MIcon XSmall Class="ml-1 mt-n2">mdi-open-in-new</MIcon>
</MButton>
</SectionContent>

Expand All @@ -19,7 +20,7 @@
<div class="intro-subtitle">基于Material Design , MAUI的最佳拍档</div>
<div class="intro-actions d-flex align-center">
<MButton Class="gradual-btn" Text Ripple="false" Href="https://docs.masastack.com/blazor/getting-started/installation">开始使用</MButton>
<MButton Text Ripple="false" Class="text-capitalize" Href="https://github.com/BlazorComponent/MASA.Blazor">
<MButton Text Ripple="false" Class="text-capitalize" Href="https://github.com/masastack/MASA.Blazor">
<MIcon Class="mr-2">mdi-github</MIcon>
Github
</MButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Href="https://docs.masastack.com/framework/concepts/overview"
Target="_blank">
文档
<MIcon XSmall Class="ml-1 mt-n2">mdi-open-in-new</MIcon>
</MButton>
</SectionContent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Href="https://docs.masastack.com/stack/masa-stack-1.0/introduce"
Target="_blank">
文档
<MIcon XSmall Class="ml-1 mt-n2">mdi-open-in-new</MIcon>
</MButton>
</SectionContent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@
}
<MListItemContent>
<MListItemTitle Class="h8 regular--text">
<div style="@item.Style"> @item.Title</div>
<div style="@item.Style">
@item.Title
@if(item.IsExternal)
{
<MIcon XSmall Color="regular" Class="ml-1 mt-n2">mdi-open-in-new</MIcon>
}
</div>
</MListItemTitle>
<MListItemSubtitle Class="body2 regular3--text">@item.Subtitle</MListItemSubtitle>
</MListItemContent>
Expand Down
1 change: 0 additions & 1 deletion src/MASA.OfficialWebsite.WebApp/Components/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
@using Microsoft.JSInterop
@using MASA.OfficialWebsite.WebApp
@using MASA.OfficialWebsite.WebApp.Components
@using BlazorComponent
@using Masa.Blazor
@using Masa.Blazor.Presets
@using static MASA.OfficialWebsite.WebApp.Data.ActivityData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Masa.Blazor" Version="1.3.2"/>
<PackageReference Include="Masa.Blazor" Version="1.6.6"/>
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/MASA.OfficialWebsite.WebApp/Models/NavItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class NavItem

public bool IsSubheader => Subheader is not null;

public bool IsExternal => Href is not null && Href.StartsWith("http");

public bool Disabled { get; set; }

public string Style
Expand Down

0 comments on commit f9f4d47

Please sign in to comment.