diff --git a/src/Connected.Components/Components/Drawer/Drawer.razor.cs b/src/Connected.Components/Components/Drawer/Drawer.razor.cs index d7c8c3e..fca6342 100644 --- a/src/Connected.Components/Components/Drawer/Drawer.razor.cs +++ b/src/Connected.Components/Components/Drawer/Drawer.razor.cs @@ -176,12 +176,12 @@ public partial class Drawer : UIComponent, IDisposable, INavigationEventReceiver get { return new StyleBuilder() - .AddStyle(StyleList); - //.AddStyle("width", Width, !string.IsNullOrWhiteSpace(Width) && !Fixed) - //.AddStyle("--mud-drawer-width", Width, !string.IsNullOrWhiteSpace(Width) && (!Fixed || Variant == DrawerVariant.Temporary)) - //.AddStyle("height", Height, !string.IsNullOrWhiteSpace(Height)) - //.AddStyle("--mud-drawer-content-height",string.IsNullOrWhiteSpace(Height) ? _height.ToPx() : Height,Anchor == Anchor.Bottom || Anchor == Anchor.Top) - //.AddStyle("visibility", "hidden", string.IsNullOrWhiteSpace(Height) && _height == 0 && (Anchor == Anchor.Bottom || Anchor == Anchor.Top)); + .AddStyle(StyleList) + .AddStyle("width", Width, !string.IsNullOrWhiteSpace(Width) && !Fixed) + .AddStyle("--mud-drawer-width", Width, !string.IsNullOrWhiteSpace(Width) && (!Fixed || Variant == DrawerVariant.Temporary)) + .AddStyle("height", Height, !string.IsNullOrWhiteSpace(Height)) + .AddStyle("--mud-drawer-content-height", string.IsNullOrWhiteSpace(Height) ? _height.ToPx() : Height, Anchor == Anchor.Bottom || Anchor == Anchor.Top) + .AddStyle("visibility", "hidden", string.IsNullOrWhiteSpace(Height) && _height == 0 && (Anchor == Anchor.Bottom || Anchor == Anchor.Top)); } } @@ -359,6 +359,24 @@ public partial class Drawer : UIComponent, IDisposable, INavigationEventReceiver } } + /// + /// Width of left/right drawer. Only for non-fixed drawers. + /// + [Parameter] + public string Width { get; set; } + + /// + /// Width of left/right drawer. Only for non-fixed drawers. + /// + [Parameter] + public string MiniWidth { get; set; } + + /// + /// Height of top/bottom temporary drawer + /// + [Parameter] + public string Height { get; set; } + #endregion diff --git a/src/Connected.Components/Components/Drawer/DrawerContainer.razor.cs b/src/Connected.Components/Components/Drawer/DrawerContainer.razor.cs index e02c3df..e64cafa 100644 --- a/src/Connected.Components/Components/Drawer/DrawerContainer.razor.cs +++ b/src/Connected.Components/Components/Drawer/DrawerContainer.razor.cs @@ -63,6 +63,22 @@ public partial class DrawerContainer : UIComponent return _drawers.FirstOrDefault(d => d.Variant == DrawerVariant.Mini && (d.Anchor == anchor || d.Anchor == Anchor.Right)); } + private string GetDrawerWidth(Drawer drawer) + { + if (drawer == null) + return string.Empty; + + return drawer.Width; + } + + private string GetMiniDrawerWidth(Drawer drawer) + { + if (drawer == null) + return string.Empty; + + return drawer.Width; + } + #endregion #region Styling properties @@ -100,12 +116,11 @@ public partial class DrawerContainer : UIComponent get { return new StyleBuilder() - .AddStyle(StyleList); - //.AddStyle("width", Width, !string.IsNullOrWhiteSpace(Width) && !Fixed) - //.AddStyle("--mud-drawer-width", Width, !string.IsNullOrWhiteSpace(Width) && (!Fixed || Variant == DrawerVariant.Temporary)) - //.AddStyle("height", Height, !string.IsNullOrWhiteSpace(Height)) - //.AddStyle("--mud-drawer-content-height",string.IsNullOrWhiteSpace(Height) ? _height.ToPx() : Height,Anchor == Anchor.Bottom || Anchor == Anchor.Top) - //.AddStyle("visibility", "hidden", string.IsNullOrWhiteSpace(Height) && _height == 0 && (Anchor == Anchor.Bottom || Anchor == Anchor.Top)); + .AddStyle(StyleList) + .AddStyle("--mud-drawer-width-left", GetDrawerWidth(FindLeftDrawer()), !string.IsNullOrEmpty(GetDrawerWidth(FindLeftDrawer()))) + .AddStyle("--mud-drawer-width-right", GetDrawerWidth(FindRightDrawer()), !string.IsNullOrEmpty(GetDrawerWidth(FindRightDrawer()))) + .AddStyle("--mud-drawer-width-mini-left", GetMiniDrawerWidth(FindLeftMiniDrawer()), !string.IsNullOrEmpty(GetMiniDrawerWidth(FindLeftMiniDrawer()))) + .AddStyle("--mud-drawer-width-mini-right", GetMiniDrawerWidth(FindRightMiniDrawer()), !string.IsNullOrEmpty(GetMiniDrawerWidth(FindRightMiniDrawer()))); } }