From b01b4e42dfaa60ae726bd99174ce51cd1cfee713 Mon Sep 17 00:00:00 2001 From: stm Date: Wed, 11 Jan 2023 13:31:29 +0100 Subject: [PATCH] MainContent - rework --- .../Components/Drawer/Drawer.razor.cs | 2 +- .../Components/Main/MainContent.razor | 17 ++------------ .../Components/Main/MainContent.razor.cs | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 src/Connected.Components/Components/Main/MainContent.razor.cs diff --git a/src/Connected.Components/Components/Drawer/Drawer.razor.cs b/src/Connected.Components/Components/Drawer/Drawer.razor.cs index 3532703..84f0a11 100644 --- a/src/Connected.Components/Components/Drawer/Drawer.razor.cs +++ b/src/Connected.Components/Components/Drawer/Drawer.razor.cs @@ -176,7 +176,7 @@ public partial class Drawer : UIComponent, IDisposable, INavigationEventReceiver get { return new StyleBuilder() - .AddStyle(StyleList) + .AddStyle(StyleList?? "") .AddStyle("width", Width, !string.IsNullOrWhiteSpace(Width) && !Fixed) .AddStyle("drawer-width", Width, !string.IsNullOrWhiteSpace(Width) && (!Fixed || Variant == DrawerVariant.Temporary)) .AddStyle("height", Height, !string.IsNullOrWhiteSpace(Height)) diff --git a/src/Connected.Components/Components/Main/MainContent.razor b/src/Connected.Components/Components/Main/MainContent.razor index 5c85d57..81b58b6 100644 --- a/src/Connected.Components/Components/Main/MainContent.razor +++ b/src/Connected.Components/Components/Main/MainContent.razor @@ -1,20 +1,7 @@ @namespace Connected.Components @using Connected.Annotations; -@using Connected.Utilities; @inherits UIComponent -
+
@ChildContent -
- -@code { - - protected string Classname => - new CssBuilder("main-content") - .AddClass(AdditionalClassList) - .Build(); - - [Parameter] - [Category(CategoryTypes.MainContent.Behavior)] - public RenderFragment ChildContent { get; set; } -} \ No newline at end of file +
\ No newline at end of file diff --git a/src/Connected.Components/Components/Main/MainContent.razor.cs b/src/Connected.Components/Components/Main/MainContent.razor.cs new file mode 100644 index 0000000..f98e584 --- /dev/null +++ b/src/Connected.Components/Components/Main/MainContent.razor.cs @@ -0,0 +1,23 @@ +using Connected.Utilities; +using Microsoft.AspNetCore.Components; + +namespace Connected.Components; +public partial class MainContent +{ + private CssBuilder CompiledClassList + { + get + { + return new CssBuilder("main-content") + .AddClass(ClassList); + } + } + [Parameter] + public RenderFragment ChildContent { get; set; } + + /// + /// A space separated list of class names, added on top of the default class list. + /// + [Parameter] + public string? ClassList { get; set; } +}