From ed51abd2cf5655020f9f8eb0b8c0ffc27bd3d660 Mon Sep 17 00:00:00 2001 From: tesar-tech Date: Wed, 11 Dec 2024 11:42:04 +0100 Subject: [PATCH] Style providers for collapse - removing accordion booleans --- .../Providers/AntDesignClassProvider.cs | 12 ++++++------ .../Providers/BootstrapClassProvider.cs | 12 ++++++------ .../Providers/Bootstrap5ClassProvider.cs | 12 ++++++------ .../Providers/BulmaClassProvider.cs | 17 +++++++++-------- .../Providers/FluentUI2ClassProvider.cs | 12 ++++++------ .../Providers/TailwindClassProvider.cs | 16 +++++++--------- .../Components/Collapse/Collapse.razor.cs | 4 ++-- .../Components/Collapse/CollapseBody.razor.cs | 4 ++-- .../Components/Collapse/CollapseHeader.razor.cs | 2 +- Source/Blazorise/Interfaces/IClassProvider.cs | 16 +++++++++------- Source/Blazorise/Providers/ClassProvider.cs | 12 ++++++------ .../Blazorise/Providers/EmptyClassProvider.cs | 12 ++++++------ 12 files changed, 66 insertions(+), 65 deletions(-) diff --git a/Source/Blazorise.AntDesign/Providers/AntDesignClassProvider.cs b/Source/Blazorise.AntDesign/Providers/AntDesignClassProvider.cs index efbd768b95..e66e901105 100644 --- a/Source/Blazorise.AntDesign/Providers/AntDesignClassProvider.cs +++ b/Source/Blazorise.AntDesign/Providers/AntDesignClassProvider.cs @@ -752,17 +752,17 @@ public override string BarToggler( BarMode mode, BarTogglerMode togglerMode ) => #region Collapse - public override string Collapse( bool accordion ) => "ant-collapse-item"; + public override string Collapse() => "ant-collapse-item"; - public override string CollapseActive( bool accordion, bool active ) => active ? "ant-collapse-item-active" : null; + public override string CollapseActive( bool active ) => active ? "ant-collapse-item-active" : null; - public override string CollapseHeader( bool accordion ) => "ant-collapse-header"; + public override string CollapseHeader() => "ant-collapse-header"; - public override string CollapseBody( bool accordion ) => "ant-collapse-content"; + public override string CollapseBody() => "ant-collapse-content"; - public override string CollapseBodyActive( bool accordion, bool active ) => active ? "ant-collapse-content-active" : "ant-collapse-content-inactive"; + public override string CollapseBodyActive( bool active ) => active ? "ant-collapse-content-active" : "ant-collapse-content-inactive"; - public override string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ) => "ant-collapse-content-box"; + public override string CollapseBodyContent() => "ant-collapse-content-box"; #endregion diff --git a/Source/Blazorise.Bootstrap/Providers/BootstrapClassProvider.cs b/Source/Blazorise.Bootstrap/Providers/BootstrapClassProvider.cs index 6a12e41b6d..ae5b79c74a 100644 --- a/Source/Blazorise.Bootstrap/Providers/BootstrapClassProvider.cs +++ b/Source/Blazorise.Bootstrap/Providers/BootstrapClassProvider.cs @@ -771,17 +771,17 @@ public override string BarDropdownToggleDisabled( BarMode mode, bool isBarDropDo #region Collapse - public override string Collapse( bool accordion ) => "card"; + public override string Collapse() => "card"; - public override string CollapseActive( bool accordion, bool active ) => null; + public override string CollapseActive( bool active ) => null; - public override string CollapseHeader( bool accordion ) => "card-header"; + public override string CollapseHeader() => "card-header"; - public override string CollapseBody( bool accordion ) => "collapse"; + public override string CollapseBody() => "collapse"; - public override string CollapseBodyActive( bool accordion, bool active ) => active ? Show() : null; + public override string CollapseBodyActive( bool active ) => active ? Show() : null; - public override string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ) => "card-body"; + public override string CollapseBodyContent() => "card-body"; #endregion diff --git a/Source/Blazorise.Bootstrap5/Providers/Bootstrap5ClassProvider.cs b/Source/Blazorise.Bootstrap5/Providers/Bootstrap5ClassProvider.cs index cca623dbc4..dc218babcf 100644 --- a/Source/Blazorise.Bootstrap5/Providers/Bootstrap5ClassProvider.cs +++ b/Source/Blazorise.Bootstrap5/Providers/Bootstrap5ClassProvider.cs @@ -766,17 +766,17 @@ public override string BarDropdownToggleDisabled( BarMode mode, bool isBarDropDo #region Collapse - public override string Collapse( bool accordion ) => accordion ? "accordion-item" : "card"; + public override string Collapse() => "card"; - public override string CollapseActive( bool accordion, bool active ) => null; + public override string CollapseActive( bool active ) => null; - public override string CollapseHeader( bool accordion ) => accordion ? "accordion-header" : "card-header"; + public override string CollapseHeader() => "card-header"; - public override string CollapseBody( bool accordion ) => accordion ? "accordion-collapse collapse" : "collapse"; + public override string CollapseBody() => "collapse"; - public override string CollapseBodyActive( bool accordion, bool active ) => active ? Show() : null; + public override string CollapseBodyActive( bool active ) => active ? Show() : null; - public override string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ) => accordion ? "accordion-body" : "card-body"; + public override string CollapseBodyContent() => "card-body"; #endregion diff --git a/Source/Blazorise.Bulma/Providers/BulmaClassProvider.cs b/Source/Blazorise.Bulma/Providers/BulmaClassProvider.cs index 3fe3ab432f..b056800c1f 100644 --- a/Source/Blazorise.Bulma/Providers/BulmaClassProvider.cs +++ b/Source/Blazorise.Bulma/Providers/BulmaClassProvider.cs @@ -1,8 +1,10 @@ #region Using directives + using System.Collections.Generic; using System.Linq; using System.Text; using Blazorise.Extensions; + #endregion namespace Blazorise.Bulma.Providers; @@ -735,7 +737,6 @@ public override string BarDropdownToggleDisabled( BarMode mode, bool isBarDropDo public override string BarLabel( BarMode mode ) => "b-bar-label"; - #endregion #region Accordion @@ -762,17 +763,17 @@ public override string BarDropdownToggleDisabled( BarMode mode, bool isBarDropDo #region Collapse - public override string Collapse( bool accordion ) => "card"; + public override string Collapse() => "card"; - public override string CollapseActive( bool accordion, bool active ) => null; + public override string CollapseActive( bool active ) => null; - public override string CollapseHeader( bool accordion ) => "card-header"; + public override string CollapseHeader() => "card-header"; - public override string CollapseBody( bool accordion ) => "collapse"; + public override string CollapseBody() => "collapse"; - public override string CollapseBodyActive( bool accordion, bool active ) => active ? Show() : null; + public override string CollapseBodyActive( bool active ) => active ? Show() : null; - public override string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ) => "card-content"; + public override string CollapseBodyContent() => "card-content"; #endregion @@ -822,7 +823,7 @@ public override string Column( bool grid, ColumnWidth columnWidth, Breakpoint br } public override string Column( bool grid, IEnumerable columnDefinitions ) - => string.Join( ' ', columnDefinitions.Select( x => Column( grid, x.ColumnWidth, x.Breakpoint, x.Offset ) ) ); + => string.Join( ' ', columnDefinitions.Select( x => Column( grid, x.ColumnWidth, x.Breakpoint, x.Offset ) ) ); #endregion diff --git a/Source/Blazorise.FluentUI2/Providers/FluentUI2ClassProvider.cs b/Source/Blazorise.FluentUI2/Providers/FluentUI2ClassProvider.cs index cae3322373..34e9532ef9 100644 --- a/Source/Blazorise.FluentUI2/Providers/FluentUI2ClassProvider.cs +++ b/Source/Blazorise.FluentUI2/Providers/FluentUI2ClassProvider.cs @@ -911,17 +911,17 @@ public override string BarDropdownMenuContainer( BarMode mode ) => mode == Blazo #region Collapse - public override string Collapse( bool accordion ) => "fui-AccordionItem"; + public override string Collapse() => "fui-AccordionItem"; - public override string CollapseActive( bool accordion, bool active ) => active ? "fui-AccordionItem-active" : null; + public override string CollapseActive( bool active ) => active ? "fui-AccordionItem-active" : null; - public override string CollapseHeader( bool accordion ) => "fui-AccordionHeader"; + public override string CollapseHeader() => "fui-AccordionHeader"; - public override string CollapseBody( bool accordion ) => "fui-AccordionPanel"; + public override string CollapseBody() => "fui-AccordionPanel"; - public override string CollapseBodyActive( bool accordion, bool active ) => active ? "fui-AccordionPanel-show" : null; + public override string CollapseBodyActive( bool active ) => active ? "fui-AccordionPanel-show" : null; - public override string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ) => "card-body"; + public override string CollapseBodyContent() => "card-body"; #endregion diff --git a/Source/Blazorise.Tailwind/Providers/TailwindClassProvider.cs b/Source/Blazorise.Tailwind/Providers/TailwindClassProvider.cs index 0799357321..3f3c5d9bca 100644 --- a/Source/Blazorise.Tailwind/Providers/TailwindClassProvider.cs +++ b/Source/Blazorise.Tailwind/Providers/TailwindClassProvider.cs @@ -1141,20 +1141,18 @@ public override string AccordionBodyContent( bool firstInAccordion, bool lastInA #region Collapse - public override string Collapse( bool accordion ) => "b-collapse"; + public override string Collapse() => "b-collapse"; - public override string CollapseActive( bool accordion, bool active ) => "b-collapse-active"; + public override string CollapseActive( bool active ) => "b-collapse-active"; - public override string CollapseHeader( bool accordion ) => "b-collapse-header"; + public override string CollapseHeader() => "b-collapse-header"; - public override string CollapseBody( bool accordion ) => "b-collapse-body"; + public override string CollapseBody() => "b-collapse-body"; - public override string CollapseBodyActive( bool accordion, bool active ) => active ? null : "hidden"; + public override string CollapseBodyActive( bool active ) => active ? null : "hidden"; - public override string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ) - => lastInAccordion - ? "p-5 font-light border border-gray-200 dark:border-gray-700 dark:bg-gray-900" - : "p-5 font-light border border-b-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900"; + public override string CollapseBodyContent() + => "p-5 font-light border border-b-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900"; #endregion diff --git a/Source/Blazorise/Components/Collapse/Collapse.razor.cs b/Source/Blazorise/Components/Collapse/Collapse.razor.cs index f98c15633b..7acc01b01d 100644 --- a/Source/Blazorise/Components/Collapse/Collapse.razor.cs +++ b/Source/Blazorise/Components/Collapse/Collapse.razor.cs @@ -23,8 +23,8 @@ public partial class Collapse : BaseComponent, IDisposable /// protected override void BuildClasses( ClassBuilder builder ) { - builder.Append( ClassProvider.Collapse( false ) ); - builder.Append( ClassProvider.CollapseActive( false, Visible ) ); + builder.Append( ClassProvider.Collapse() ); + builder.Append( ClassProvider.CollapseActive( Visible ) ); base.BuildClasses( builder ); } diff --git a/Source/Blazorise/Components/Collapse/CollapseBody.razor.cs b/Source/Blazorise/Components/Collapse/CollapseBody.razor.cs index 35ac218cc7..d32c1aa017 100644 --- a/Source/Blazorise/Components/Collapse/CollapseBody.razor.cs +++ b/Source/Blazorise/Components/Collapse/CollapseBody.razor.cs @@ -33,7 +33,7 @@ public CollapseBody() /// protected override void BuildClasses( ClassBuilder builder ) { - builder.Append( ClassProvider.CollapseBodyActive( false, Visible ) ); + builder.Append( ClassProvider.CollapseBodyActive( Visible ) ); base.BuildClasses( builder ); } @@ -44,7 +44,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// Class builder used to append the classnames. private void BuildBodyClasses( ClassBuilder builder ) { - builder.Append( ClassProvider.CollapseBodyContent( false, false, false ) ); + builder.Append( ClassProvider.CollapseBodyContent() ); } /// diff --git a/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs b/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs index 07fed09d92..45d9c46393 100644 --- a/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs +++ b/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs @@ -21,7 +21,7 @@ public partial class CollapseHeader : BaseComponent /// protected override void BuildClasses( ClassBuilder builder ) { - builder.Append( ClassProvider.CollapseHeader( false ) ); + builder.Append( ClassProvider.CollapseHeader() ); base.BuildClasses( builder ); } diff --git a/Source/Blazorise/Interfaces/IClassProvider.cs b/Source/Blazorise/Interfaces/IClassProvider.cs index b279920b42..bac39b4716 100644 --- a/Source/Blazorise/Interfaces/IClassProvider.cs +++ b/Source/Blazorise/Interfaces/IClassProvider.cs @@ -1,5 +1,7 @@ #region Using directives + using System.Collections.Generic; + #endregion namespace Blazorise; @@ -730,17 +732,17 @@ public interface IClassProvider #region Collapse - string Collapse( bool accordion ); + string Collapse(); - string CollapseActive( bool accordion, bool active ); + string CollapseActive( bool active ); - string CollapseHeader( bool accordion ); + string CollapseHeader(); - string CollapseBody( bool accordion ); + string CollapseBody(); - string CollapseBodyActive( bool accordion, bool active ); + string CollapseBodyActive( bool active ); - string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ); + string CollapseBodyContent( ); #endregion @@ -1320,7 +1322,7 @@ public interface IClassProvider #region Enums - /* + /* * These methods are named with "To" prefix to indicate they're used only to convert en enum to the equivalent * keyword in the implementation class provider. */ diff --git a/Source/Blazorise/Providers/ClassProvider.cs b/Source/Blazorise/Providers/ClassProvider.cs index c4d099819c..bea588e226 100644 --- a/Source/Blazorise/Providers/ClassProvider.cs +++ b/Source/Blazorise/Providers/ClassProvider.cs @@ -731,17 +731,17 @@ public abstract class ClassProvider : IClassProvider #region Collapse - public abstract string Collapse( bool accordion ); + public abstract string Collapse( ); - public abstract string CollapseActive( bool accordion, bool active ); + public abstract string CollapseActive( bool active ); - public abstract string CollapseHeader( bool accordion ); + public abstract string CollapseHeader( ); - public abstract string CollapseBody( bool accordion ); + public abstract string CollapseBody( ); - public abstract string CollapseBodyActive( bool accordion, bool active ); + public abstract string CollapseBodyActive( bool active ); - public abstract string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ); + public abstract string CollapseBodyContent( ); #endregion diff --git a/Source/Blazorise/Providers/EmptyClassProvider.cs b/Source/Blazorise/Providers/EmptyClassProvider.cs index e4e4206b4b..1394455f02 100644 --- a/Source/Blazorise/Providers/EmptyClassProvider.cs +++ b/Source/Blazorise/Providers/EmptyClassProvider.cs @@ -735,17 +735,17 @@ class EmptyClassProvider : IClassProvider #region Collapse - public string Collapse( bool accordion ) => null; + public string Collapse() => null; - public string CollapseActive( bool accordion, bool active ) => null; + public string CollapseActive( bool active ) => null; - public string CollapseHeader( bool accordion ) => null; + public string CollapseHeader() => null; - public string CollapseBody( bool accordion ) => null; + public string CollapseBody() => null; - public string CollapseBodyActive( bool accordion, bool active ) => null; + public string CollapseBodyActive( bool active ) => null; - public string CollapseBodyContent( bool accordion, bool firstInAccordion, bool lastInAccordion ) => null; + public string CollapseBodyContent() => null; #endregion