Skip to content

[dev-v5] Update the FluentLayout component #3743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 0 additions & 130 deletions examples/Demo/FluentUI.Demo.Client/DebugPages/DebugLayout.razor

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
@page "/Layout/Debug"
@using Microsoft.AspNetCore.Components.Rendering

<h1>Layout Debug Page</h1>

<div style="margin: 24px;">

@_renderOptions

<FluentTextArea @bind-Value="@HamburgerContent" Label="Hamburger content" />

<FluentStack Margin="@Margin.Vertical2">
View: @(MobileView ? "📱 Mobile" : "💻 Desktop")
<FluentSpacer />
Opened: @Opened
</FluentStack>

<div style="resize: horizontal; overflow: hidden;">
<FluentLayout GlobalScrollbar="@GlobalScrollbar" Height="400px" Style="@CommonStyles.NeutralBorder1" OnBreakpointEnter="@(e => MobileView = e)" MenuDeferredLoading="@MenuDeferredLoading">

@if (Header.Visible)
{
<!-- Header -->
<FluentLayoutItem Area="@LayoutArea.Header" Sticky="@Header.Sticky">

<!-- Hamburger menu -->
<FluentLayoutHamburger OnOpened="@(e => Opened = e.Opened)"
ChildContent="@(string.IsNullOrWhiteSpace(HamburgerContent) ? null : builder => { builder.AddMarkupContent(0, HamburgerContent); })" />

<FluentText Weight="TextWeight.Bold" Size="TextSize.Size400">
Microsoft Demo
</FluentText>
<FluentSpacer />
<FluentButton Appearance="ButtonAppearance.Primary" Shape="ButtonShape.Rounded">
Sign in
</FluentButton>

<!-- Second Hamburger menu -->
<FluentLayoutHamburger OnOpened="@(e => Opened = e.Opened)"
ChildContent="@(string.IsNullOrWhiteSpace(HamburgerContent) ? null : builder => { builder.AddMarkupContent(0, HamburgerContent); })" />

</FluentLayoutItem>
}

@if (Menu.Visible)
{
<!-- Menu -->
<FluentLayoutItem Area="@LayoutArea.Menu" Sticky="@Menu.Sticky"
Width="150px" Padding="@Padding.All2"
Style="border-right: var(--strokeWidthThin) solid var(--colorNeutralStroke1);">

<FluentText Weight="TextWeight.Bold">Navigation</FluentText>
@NavigationContent
</FluentLayoutItem>
}

@if (Content.Visible)
{
<!-- Content -->
<FluentLayoutItem Area="@LayoutArea.Content" Padding="@Padding.All3">
<FluentText Weight="TextWeight.Bold">Content</FluentText>
@BodyContent
</FluentLayoutItem>
}

@if (Aside.Visible)
{
<!-- Aside -->
<FluentLayoutItem Area="@LayoutArea.Aside" Width="120px" Sticky="Aside.Sticky"
Style="padding: 8px; background-color: var(--colorBrandBackground2);">
<FluentText Weight="TextWeight.Bold">News</FluentText>
@AsideContent
</FluentLayoutItem>
}

@if (Footer.Visible)
{
<!-- Footer -->
<FluentLayoutItem Area="@LayoutArea.Footer" Sticky="@Footer.Sticky">
&copy; Microsoft @DateTime.Now.Year
</FluentLayoutItem>
}

</FluentLayout>
</div>

</div>

<h1>Standalone Hamburger</h1>
<FluentLayoutHamburger Visible="true"
Icon="@(new Icons.Regular.Size20.LineHorizontal4().WithColor(Color.Primary))">
Standalone Hamburger Content
</FluentLayoutHamburger>

@code
{
protected void RenderOptions(RenderTreeBuilder __builder)
{
<table>
<thead>
<tr>
<th>Area</th>
<th>Visible</th>
<th>Sticky</th>
</tr>
</thead>
<tbody>
<tr>
<td>Global Scrollbar</td>
<td><InputCheckbox @bind-Value="@(GlobalScrollbar)" /></td>
</tr>
<tr>
<td>Menu Deferred Loading</td>
<td><InputCheckbox @bind-Value="@(MenuDeferredLoading)" /></td>
</tr>
<tr>
<td>Header</td>
<td><InputCheckbox @bind-Value="@(Header.Visible)" /></td>
<td><InputCheckbox @bind-Value="@(Header.Sticky)" /></td>
</tr>
<tr>
<td>Menu</td>
<td><InputCheckbox @bind-Value="@(Menu.Visible)" /></td>
<td><InputCheckbox @bind-Value="@(Menu.Sticky)" /></td>
</tr>
<tr>
<td>Content</td>
<td><InputCheckbox @bind-Value="@(Content.Visible)" /></td>
<td></td>
</tr>
<tr>
<td>Aside</td>
<td><InputCheckbox @bind-Value="@(Aside.Visible)" /></td>
<td><InputCheckbox @bind-Value="@(Aside.Sticky)" /></td>
</tr>
<tr>
<td>Footer</td>
<td><InputCheckbox @bind-Value="@(Footer.Visible)" /></td>
<td><InputCheckbox @bind-Value="@(Footer.Sticky)" /></td>
</tr>
</tbody>
</table>
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// ------------------------------------------------------------------------
// MIT License - Copyright (c) Microsoft Corporation. All rights reserved.
// ------------------------------------------------------------------------

using Microsoft.AspNetCore.Components;

namespace FluentUI.Demo.Client.Documentation.Components.Layout.DebugPages;

public partial class DebugLayout
{
private bool GlobalScrollbar = true;
private bool MenuDeferredLoading;
private string HamburgerContent = string.Empty;
private readonly RenderFragment _renderOptions;
private readonly Option Header = new() { Visible = true, Sticky = false };
private readonly Option Menu = new() { Visible = true, Sticky = false };
private readonly Option Content = new() { Visible = true, Sticky = false };
private readonly Option Aside = new() { Visible = true, Sticky = false };
private readonly Option Footer = new() { Visible = true, Sticky = false };

public bool MobileView { get; set; }
public bool Opened { get; set; }

private class Option
{
public bool Visible { get; set; }
public bool Sticky { get; set; }
}

public DebugLayout()
{
_renderOptions = RenderOptions;
}

private static readonly MarkupString NavigationContent = SampleData.Text.Titles.Take(20).ToMarkupList("li");
private static readonly MarkupString BodyContent = SampleData.Text.LoremIpsum.Take(10).ToMarkupList("p");
private static readonly MarkupString AsideContent = (MarkupString)SampleData.Text.LoremIpsum.ElementAt(2)[..200];
}
Loading