From f770bd26bcebf8e89cc65632b85f8dd5e70eb2d2 Mon Sep 17 00:00:00 2001 From: markosteger Date: Thu, 9 Mar 2023 14:32:33 +0100 Subject: [PATCH] GridRowContent - fixed Collapsable --- ...onnected.Components.Showcase.Runner.csproj | 5 ++++ .../Pages/Index.razor | 17 +++++++++++--- .../Components/FormWizardStep.razor.cs | 4 ++-- .../Components/GridRowContent.razor.cs | 15 ++++++++---- src/Connected.Components/Enums/Color.cs | 2 +- .../Enums/ThemeProvider.cs | 23 +++++++++++++++++++ 6 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 src/Connected.Components/Enums/ThemeProvider.cs diff --git a/src/Connected.Components.Showcase.Runner/Connected.Components.Showcase.Runner.csproj b/src/Connected.Components.Showcase.Runner/Connected.Components.Showcase.Runner.csproj index 015518e..f6e0064 100644 --- a/src/Connected.Components.Showcase.Runner/Connected.Components.Showcase.Runner.csproj +++ b/src/Connected.Components.Showcase.Runner/Connected.Components.Showcase.Runner.csproj @@ -22,4 +22,9 @@ + + + + + diff --git a/src/Connected.Components.Showcase.Runner/Pages/Index.razor b/src/Connected.Components.Showcase.Runner/Pages/Index.razor index 99ffedd..217992f 100644 --- a/src/Connected.Components.Showcase.Runner/Pages/Index.razor +++ b/src/Connected.Components.Showcase.Runner/Pages/Index.razor @@ -4,9 +4,20 @@

Component Sandbox

- - - + + @for (int i = 0; i < 5; i++) + { + int num = i; + + + Fixed content @num.ToString() + + + Collapsable content @num.ToString() + + + } +

Izbran datum je: @date

diff --git a/src/Connected.Components/Components/FormWizardStep.razor.cs b/src/Connected.Components/Components/FormWizardStep.razor.cs index 2c64912..fbaa5b9 100644 --- a/src/Connected.Components/Components/FormWizardStep.razor.cs +++ b/src/Connected.Components/Components/FormWizardStep.razor.cs @@ -46,7 +46,7 @@ public partial class FormWizardStep get { return new CssBuilder("dot") - .AddClass("completed",Completed) + .AddClass("completed", Completed) .AddClass("next", Active) .Build(); } @@ -62,7 +62,7 @@ public partial class FormWizardStep get { return new StyleBuilder() - .AddStyle("display","none", (!Active && !IsNext && !IsPrevious)) //Workarround for more than 2 steps where steps didnt hide after + .AddStyle("display", "none", (!Active && !IsNext && !IsPrevious)) //Workarround for more than 2 steps where steps didnt hide after .AddStyle(Style) .Build(); } diff --git a/src/Connected.Components/Components/GridRowContent.razor.cs b/src/Connected.Components/Components/GridRowContent.razor.cs index 7f07735..4c76533 100644 --- a/src/Connected.Components/Components/GridRowContent.razor.cs +++ b/src/Connected.Components/Components/GridRowContent.razor.cs @@ -26,15 +26,22 @@ public partial class GridRowContent : ComponentBase { get { - return new CssBuilder("row") - .AddClass("collapsed", Collapsable) - .AddClass("show", (Collapsable ? Parent?.CollapsedItemShown : false)) - .Build(); + CssBuilder cssBuilder = new CssBuilder("row"); + + cssBuilder.AddClass("collapsed", Collapsable); + + if (Parent is not null) + { + cssBuilder.AddClass("show", (Collapsable ? Parent.CollapsedItemShown : false)); + } + + return cssBuilder.Build(); } } protected override async Task OnInitializedAsync() { + if (Parent is not null) { if (Parent.Children is null) Parent.Children = new(); diff --git a/src/Connected.Components/Enums/Color.cs b/src/Connected.Components/Enums/Color.cs index eadc7e8..96cce10 100644 --- a/src/Connected.Components/Enums/Color.cs +++ b/src/Connected.Components/Enums/Color.cs @@ -5,7 +5,7 @@ namespace Connected; public enum Color { [Description("core")] - Core, + Core, [Description("primary")] Primary, diff --git a/src/Connected.Components/Enums/ThemeProvider.cs b/src/Connected.Components/Enums/ThemeProvider.cs new file mode 100644 index 0000000..00b01ff --- /dev/null +++ b/src/Connected.Components/Enums/ThemeProvider.cs @@ -0,0 +1,23 @@ +using System.ComponentModel; + +namespace Connected; + +public enum Theme +{ + [Description("")] + Default, + + [Description("dark")] + Dark, + + [Description("light")] + Light, + + [Description("pink")] + Pink +} + +public static class ThemeProvider +{ + public static Theme theme { get; set; } = Theme.Default; +} \ No newline at end of file