Skip to content

Commit

Permalink
Style providers for collapse - removing accordion booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
tesar-tech committed Dec 11, 2024
1 parent a3b31d1 commit ed51abd
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 65 deletions.
12 changes: 6 additions & 6 deletions Source/Blazorise.AntDesign/Providers/AntDesignClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions Source/Blazorise.Bootstrap/Providers/BootstrapClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions Source/Blazorise.Bootstrap5/Providers/Bootstrap5ClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 9 additions & 8 deletions Source/Blazorise.Bulma/Providers/BulmaClassProvider.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -735,7 +737,6 @@ public override string BarDropdownToggleDisabled( BarMode mode, bool isBarDropDo

public override string BarLabel( BarMode mode ) => "b-bar-label";


#endregion

#region Accordion
Expand All @@ -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

Expand Down Expand Up @@ -822,7 +823,7 @@ public override string Column( bool grid, ColumnWidth columnWidth, Breakpoint br
}

public override string Column( bool grid, IEnumerable<ColumnDefinition> 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

Expand Down
12 changes: 6 additions & 6 deletions Source/Blazorise.FluentUI2/Providers/FluentUI2ClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 7 additions & 9 deletions Source/Blazorise.Tailwind/Providers/TailwindClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Source/Blazorise/Components/Collapse/Collapse.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public partial class Collapse : BaseComponent, IDisposable
/// <inheritdoc/>
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 );
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Blazorise/Components/Collapse/CollapseBody.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public CollapseBody()
/// <inheritdoc/>
protected override void BuildClasses( ClassBuilder builder )
{
builder.Append( ClassProvider.CollapseBodyActive( false, Visible ) );
builder.Append( ClassProvider.CollapseBodyActive( Visible ) );

base.BuildClasses( builder );
}
Expand All @@ -44,7 +44,7 @@ protected override void BuildClasses( ClassBuilder builder )
/// <param name="builder">Class builder used to append the classnames.</param>
private void BuildBodyClasses( ClassBuilder builder )
{
builder.Append( ClassProvider.CollapseBodyContent( false, false, false ) );
builder.Append( ClassProvider.CollapseBodyContent() );
}

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class CollapseHeader : BaseComponent
/// <inheritdoc/>
protected override void BuildClasses( ClassBuilder builder )
{
builder.Append( ClassProvider.CollapseHeader( false ) );
builder.Append( ClassProvider.CollapseHeader() );

base.BuildClasses( builder );
}
Expand Down
16 changes: 9 additions & 7 deletions Source/Blazorise/Interfaces/IClassProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#region Using directives

using System.Collections.Generic;

#endregion

namespace Blazorise;
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
*/
Expand Down
12 changes: 6 additions & 6 deletions Source/Blazorise/Providers/ClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions Source/Blazorise/Providers/EmptyClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ed51abd

Please sign in to comment.