Skip to content

Commit

Permalink
Updated to MudBlazor 8 RC2
Browse files Browse the repository at this point in the history
  • Loading branch information
danheron committed Jan 14, 2025
1 parent ec74109 commit 686ef84
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 65 deletions.
2 changes: 1 addition & 1 deletion Heron.MudCalendar.Docs/Heron.MudCalendar.Docs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="8.0.0-preview.5" />
<PackageReference Include="MudBlazor" Version="8.0.0-rc.2" />
</ItemGroup>

<ItemGroup>
Expand Down
103 changes: 47 additions & 56 deletions Heron.MudCalendar.Docs/Pages/Api.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,31 @@
@using MudBlazor.Docs.Components
@namespace MudBlazor.Docs.Pages.Api

<style>
.mud-table-toolbar {
height: auto;
}
[id] {
scroll-margin-top: 65px;
}
</style>

<DocsPage>
@if (DocumentedType != null)
{
<DocsPageHeader Title="@Title" />
<DocsPageContent>
<ApiBreadcrumbs Type="@DocumentedType" />

@if (DocumentedType.Summary != null)
{
<ApiText Text="@DocumentedType.Summary" />
}
<DocsPageHeader Title="@Title" IsApi="true" Component="@TypeName" />

@if (ShowInheritance)
{
<DocsPageSection>
<SectionHeader Title="Inheritance" />
<SectionContent Outlined="true" IsApiSection="true">
<MudGrid Class="pa-0">
<MudItem xs="12">
<ApiTypeHierarchy TypeName="@DocumentedType.Name" />
</MudItem>
</MudGrid>
</SectionContent>
</DocsPageSection>
}
<DocsPageContent>

@if (DocumentedType.Properties.Count > 0)
{
<DocsPageSection>
<SectionHeader Title="Properties" />
<SectionContent Outlined="true" IsApiSection="true">
<MudGrid Class="pa-0">
<MudItem xs="12">
<ApiMemberTable Mode="@ApiMemberTableMode.Properties" TypeName="@DocumentedType.Name" />
</MudItem>
</MudGrid>
<ApiMemberTable Mode="@ApiMemberTableMode.Properties" Type="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}
Expand All @@ -46,11 +36,7 @@
<DocsPageSection>
<SectionHeader Title="Methods" />
<SectionContent Outlined="true" IsApiSection="true">
<MudGrid Class="pa-0">
<MudItem xs="12">
<ApiMemberTable Mode="@ApiMemberTableMode.Methods" TypeName="@DocumentedType.Name" />
</MudItem>
</MudGrid>
<ApiMemberTable Mode="@ApiMemberTableMode.Methods" Type="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}
Expand All @@ -60,25 +46,17 @@
<DocsPageSection>
<SectionHeader Title="Fields" />
<SectionContent Outlined="true" IsApiSection="true">
<MudGrid Class="pa-0">
<MudItem xs="12">
<ApiMemberTable Mode="@ApiMemberTableMode.Fields" TypeName="@DocumentedType.Name" />
</MudItem>
</MudGrid>
<ApiMemberTable Mode="@ApiMemberTableMode.Fields" Type="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}

@if (DocumentedType.Events.Count > 0)
{
<DocsPageSection>
<SectionHeader Title="Fields" />
<SectionHeader Title="Events" />
<SectionContent Outlined="true" IsApiSection="true">
<MudGrid Class="pa-0">
<MudItem xs="12">
<ApiMemberTable Mode="@ApiMemberTableMode.Events" TypeName="@DocumentedType.Name" />
</MudItem>
</MudGrid>
<ApiMemberTable Mode="@ApiMemberTableMode.Events" Type="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}
Expand All @@ -88,11 +66,17 @@
<DocsPageSection>
<SectionHeader Title="Derived Classes" />
<SectionContent Outlined="true" IsApiSection="true">
<MudGrid Class="pa-0">
<MudItem xs="12">
<ApiTypeTable BaseType="@DocumentedType" />
</MudItem>
</MudGrid>
<ApiTypeTable BaseType="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}

@if (DocumentedType.Links.Count > 0)
{
<DocsPageSection>
<SectionHeader Title="See Also" />
<SectionContent Outlined="true" IsApiSection="true">
<ApiSeeAlsoLinks Type="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}
Expand All @@ -102,25 +86,32 @@
<DocsPageSection>
<SectionHeader Title="Global Settings" />
<SectionContent Outlined="true" IsApiSection="true">
<MudGrid Class="pa-0">
<MudItem xs="12">
<ApiGlobalSettingTable Type="@DocumentedType" />
</MudItem>
</MudGrid>
<ApiMemberTable Mode="ApiMemberTableMode.Globals" Type="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}

@if (ShowInheritance)
{
<DocsPageSection>
<SectionHeader Title="Inheritance" />
<SectionContent Outlined="true" IsApiSection="true">
<ApiTypeHierarchy Type="@DocumentedType" />
</SectionContent>
</DocsPageSection>
}

</DocsPageContent>
}
else
{
<DocsPageHeader Title="@(TypeName + " Not Found")" />
<DocsPageHeader Title="404 Not Found" />
<DocsPageContent>
<MudGrid>
<MudItem xs="12">
<MudAlert Severity="Severity.Warning">Sorry, the type @TypeName was not found.</MudAlert>
</MudItem>
</MudGrid>
@* <MudBlazorLogo Class="docs-api-404-logo" /> *@

<MudAlert Class="docs-api-404-alert" Icon="@Icons.Material.Outlined.CloudOff">
Sorry, the type <CodeInline>@TypeName</CodeInline> was not found.
</MudAlert>
</DocsPageContent>
}
</DocsPage>
28 changes: 24 additions & 4 deletions Heron.MudCalendar.Docs/Pages/Api.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using Microsoft.AspNetCore.Components;
using MudBlazor.Docs.Models;
using MudBlazor.Docs.Services;

namespace MudBlazor.Docs.Pages.Api;

Expand All @@ -14,12 +15,27 @@ namespace MudBlazor.Docs.Pages.Api;
/// </summary>
public partial class Api
{
/// <summary>
/// The service for managing menus.
/// </summary>
[Inject]
public IMenuService? MenuService { get; set; }

/// <summary>
/// The name of the type to display.
/// </summary>
[Parameter]
public string? TypeName { get; set; }

/// <summary>
/// The name of the component associated with this type.
/// </summary>
/// <remarks>
/// The friendly name for the type, if it is a MudBlazor component. For example: the type
/// <c>StackedBar</c> will return <c>Stacked Bar Chart</c>.
/// </remarks>
public string? ComponentName { get; set; }

/// <summary>
/// The name at the top of the page.
/// </summary>
Expand All @@ -28,7 +44,7 @@ public partial class Api
/// <summary>
/// Shows the inheritance hierarchy.
/// </summary>
public static bool ShowInheritance => false;
public static bool ShowInheritance => true;

/// <summary>
/// The type being displayed.
Expand All @@ -40,8 +56,12 @@ protected override void OnParametersSet()
if (DocumentedType == null || DocumentedType.Name != TypeName)
{
DocumentedType = ApiDocumentation.GetType(TypeName);
//DocumentedType = ApiDocumentation.GetType("Heron.MudCalendar.MudCalendar");
if (DocumentedType.IsComponent)
ComponentName = MenuService!.GetComponentName(TypeName!) ?? DocumentedType?.NameFriendly;
if (DocumentedType == null)
{
Title = TypeName + " Not Found";
}
else if (DocumentedType.IsComponent)
{
Title = DocumentedType.NameFriendly + " Component";
}
Expand All @@ -55,4 +75,4 @@ protected override void OnParametersSet()
}
}
}
}
}
14 changes: 14 additions & 0 deletions Heron.MudCalendar.Docs/Pages/Calendar/CalendarPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@
<HeightCalendarExample/>
</SectionContent>
</DocsPageSection>

<DocsPageSection>
<SectionHeader Title="Mobile">
<Description>
For mobile views set the <CodeInline>ShowDropdownViewSelector</CodeInline> property to true.
You can also choose which toolbar items to show using the relevant properties e.g. set <CodeInline>ShowNextPrevButtons</CodeInline> to false.
Reduce the padding size of the toolbar with the <CodeInline>ToolbarPadding</CodeInline> property.
Or hide it completely with the <CodeInline>ShowToolbar</CodeInline> property.
</Description>
</SectionHeader>
<SectionContent DarkenBackground="true" Code="MobileCalendarExample" ShowCode="false" Block="true" FullWidth="true" Assembly="typeof(CalendarPage).Assembly" AllowRunCode="false">
<MobileCalendarExample/>
</SectionContent>
</DocsPageSection>

<DocsPageSection>
<SectionHeader Title="Day/Week View Options">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@namespace Heron.MudCalendar.Docs.Examples

<div style="width: 350px; margin-left: auto; margin-right: auto;">
<MudCalendar Items="_events" Height="600" ShowDropdownViewSelector="true" ShowPrevNextButtons="false" ToolbarPadding="4" Outlined="true">
<MonthTemplate>
<div class="d-flex gap-1">
<MudIcon Icon="@Icons.Material.Filled.Circle" Color="Color.Primary" Size="Size.Small"/>
</div>
</MonthTemplate>
<WeekTemplate>
<div class="d-flex gap-1">
<MudIcon Icon="@Icons.Material.Filled.Circle" Color="Color.Primary" Size="Size.Small"/>
</div>
</WeekTemplate>
</MudCalendar>
</div>

@code {

private List<CalendarItem> _events = new()
{
new CalendarItem
{
Start = DateTime.Today.AddHours(10),
End = DateTime.Today.AddHours(11),
Text = "Event today"
},
new CalendarItem
{
Start = DateTime.Today.AddDays(1).AddHours(11),
End = DateTime.Today.AddDays(1).AddHours(12.5),
Text = "Event tomorrow"
}
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MudBlazor" Version="8.0.0-preview.5" />
<PackageReference Include="MudBlazor" Version="8.0.0-rc.2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="8.0.0-preview.5" />
<PackageReference Include="MudBlazor" Version="8.0.0-rc.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MudBlazor" Version="8.0.0-preview.5" />
<PackageReference Include="MudBlazor" Version="8.0.0-rc.2" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Heron.MudCalendar/Heron.MudCalendar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MudBlazor" Version="8.0.0-preview.5" />
<PackageReference Include="MudBlazor" Version="8.0.0-rc.2" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 686ef84

Please sign in to comment.