From 8d5445a50936e7127449cdeff2ad2a83cf29904c Mon Sep 17 00:00:00 2001 From: stm Date: Tue, 10 Jan 2023 07:57:54 +0100 Subject: [PATCH] Drawer - fixes Container - rework --- .../Components/Container/Container.razor | 2 +- .../Components/Container/Container.razor.cs | 54 ++++++++++++------- .../Components/Drawer/Drawer.razor | 1 - .../Components/Drawer/Drawer.razor.cs | 12 ++--- 4 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/Connected.Components/Components/Container/Container.razor b/src/Connected.Components/Components/Container/Container.razor index 8088c1d..16ee03e 100644 --- a/src/Connected.Components/Components/Container/Container.razor +++ b/src/Connected.Components/Components/Container/Container.razor @@ -2,6 +2,6 @@ @inherits UIComponent -
+
@ChildContent
\ No newline at end of file diff --git a/src/Connected.Components/Components/Container/Container.razor.cs b/src/Connected.Components/Components/Container/Container.razor.cs index 4427065..f1746b3 100644 --- a/src/Connected.Components/Components/Container/Container.razor.cs +++ b/src/Connected.Components/Components/Container/Container.razor.cs @@ -1,36 +1,54 @@ -using Connected.Annotations; -using Connected.Extensions; -using Connected.Utilities; +using Connected.Utilities; using Microsoft.AspNetCore.Components; namespace Connected.Components; public partial class Container : UIComponent { - protected string Classname => - new CssBuilder("container") - .AddClass($"container-fixed", Fixed) - .AddClass($"container-maxwidth-{MaxWidth.ToDescription()}", !Fixed) - .AddClass(AdditionalClassList) - .Build(); + + #region Event callbacks + #endregion + + #region Content placeholders /// - /// Set the max-width to match the min-width of the current breakpoint. This is useful if you'd prefer to design for a fixed set of sizes instead of trying to accommodate a fully fluid viewport. It's fluid by default. + /// Child content of component. /// [Parameter] - [Category(CategoryTypes.Container.Behavior)] - public bool Fixed { get; set; } = false; + public RenderFragment ChildContent { get; set; } + + #endregion + + #region Styling properties + private CssBuilder CompiledClassList + { + get + { + return new CssBuilder("container") + .AddClass(ClassList); + } + } + + protected StyleBuilder CompiledStyleList + { + get + { + return new StyleBuilder() + .AddStyle(StyleList); + + } + } /// - /// Determine the max-width of the container. The container width grows with the size of the screen. Set to false to disable maxWidth. + /// A space separated list of class names, added on top of the default class list. /// [Parameter] - [Category(CategoryTypes.Container.Behavior)] - public MaxWidth MaxWidth { get; set; } = MaxWidth.Large; + public string? ClassList { get; set; } /// - /// Child content of component. + /// A space separated list of class names, added on top of the default class list. /// [Parameter] - [Category(CategoryTypes.Container.Behavior)] - public RenderFragment ChildContent { get; set; } + public string? StyleList { get; set; } + + #endregion } diff --git a/src/Connected.Components/Components/Drawer/Drawer.razor b/src/Connected.Components/Components/Drawer/Drawer.razor index 19df66e..967cfa2 100644 --- a/src/Connected.Components/Components/Drawer/Drawer.razor +++ b/src/Connected.Components/Components/Drawer/Drawer.razor @@ -1,7 +1,6 @@ @namespace Connected.Components @inherits UIComponent -

@_screenBreakpoint.ToString()

@if (_screenBreakpoint.ToString().ToLower() != "xs") {