Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accordion: strip all usage of Collapse #5890

Merged
merged 11 commits into from
Dec 17, 2024
12 changes: 6 additions & 6 deletions Documentation/Blazorise.Docs/Components/Commercial/Faq.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
{
var index = faqInfos.IndexOf( faqInfo ) + 1;

<Collapse @key="@faqInfo" Visible="@faqInfo.Visible">
<CollapseHeader Padding="Padding.Is1.OnY">
<AccordionItem @key="@faqInfo" Visible="@faqInfo.Visible">
<AccordionHeader Padding="Padding.Is1.OnY">
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Style="text-decoration: " Margin="Margin.Is0.OnY">
<AccordionToggle Clicked="@(()=>faqInfo.Visible = !faqInfo.Visible)">@($"{index}. {faqInfo.Title}")</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
@faqInfo.Body
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>
}
</Accordion>
@code {
Expand Down
84 changes: 42 additions & 42 deletions Documentation/Blazorise.Docs/Pages/Commercial/AffiliatesPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -152,97 +152,97 @@
Frequently Asked Questions
</Heading>
<Accordion>
<Collapse>
<CollapseHeader>
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Margin="Margin.Is0.OnY">
<AccordionToggle>What is Blazorise?</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
Blazorise is a component library for Blazor, a web framework for building interactive web applications using C# instead of JavaScript. Blazorise provides a set of reusable UI components, such as buttons, forms, and modals, that you can use to build responsive and mobile-friendly web applications.
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>

<Collapse>
<CollapseHeader>
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Margin="Margin.Is0.OnY">
<AccordionToggle>How are referrals tracked?</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
<Paragraph>
a. After signing up, you will receive a personalized referral link that you can use right away. Our affiliate tracking software tracks conversions through your link.
</Paragraph>
<Paragraph>
b. To track all of your referrals, we use cookies that last 90 days.
</Paragraph>
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>

<Collapse>
<CollapseHeader>
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Margin="Margin.Is0.OnY">
<AccordionToggle>Can I run ads as an Affiliate?</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
<Paragraph>
a. <Strong>You can NOT run ads for branded keywords</Strong> such as Blazorise, blazorise, or any variations thereof, including misspellings.
</Paragraph>
<Paragraph>
b. You can run ads for anything that’s not branded, but the user should be directed to the Blazorise website first. We track all our paid traffic and any affiliates that violate our terms and conditions <Strong>will be removed from our program</Strong>.
</Paragraph>
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>

<Collapse>
<CollapseHeader>
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Margin="Margin.Is0.OnY">
<AccordionToggle>When will I get paid?</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
We pay commissions around the 20 of each month for verified sales from the previous month.
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>

<Collapse>
<CollapseHeader>
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Margin="Margin.Is0.OnY">
<AccordionToggle>How do I get paid?</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
We make regular payouts via PayPal or Wise. If you have any questions, feel free to email us at <Anchor To="mailto:[email protected]" Target="Target.Blank" Title="Mail to commercial" rel="noreferrer noopener">commercial@blazorise.com</Anchor>.
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>

<Collapse>
<CollapseHeader>
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Margin="Margin.Is0.OnY">
<AccordionToggle>Is there a minimum payment threshold?</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
<Paragraph>
a. The minimum payment threshold for all payment methods is €100.
</Paragraph>
<Paragraph>
b. If you have any questions, feel free to email us at <Anchor To="mailto:[email protected]" Target="Target.Blank" Title="Mail to commercial" rel="noreferrer noopener">commercial@blazorise.com</Anchor>.
</Paragraph>
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>

<Collapse>
<CollapseHeader>
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5" TextAlignment="TextAlignment.Start" Margin="Margin.Is0.OnY">
<AccordionToggle>Have more questions?</AccordionToggle>
</Heading>
</CollapseHeader>
<CollapseBody TextAlignment="TextAlignment.Start">
</AccordionHeader>
<AccordionBody TextAlignment="TextAlignment.Start">
Send an email to <Anchor To="mailto:[email protected]" Target="Target.Blank" Title="Mail to commercial" rel="noreferrer noopener">commercial@blazorise.com</Anchor>, and we will assist you.
</CollapseBody>
</Collapse>
</AccordionBody>
</AccordionItem>
</Accordion>
</Column>
</Row>
Expand Down
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
50 changes: 0 additions & 50 deletions Source/Blazorise.Bootstrap5/Components/Button.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#region Using directives
using Blazorise.Extensions;
using Blazorise.Utilities;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.Web;
Expand All @@ -10,28 +9,8 @@ namespace Blazorise.Bootstrap5.Components;

public class Button : Blazorise.Button
{
#region Members

bool collapseVisible;

#endregion

#region Methods

protected override void BuildClasses( ClassBuilder builder )
{
if ( ParentCollapseHeader?.ParentCollapse != null )
{
if ( ParentCollapseHeader.ParentCollapse.InsideAccordion )
builder.Append( "accordion-button" );

if ( !CollapseVisible )
builder.Append( "collapsed" );
}

base.BuildClasses( builder );
}

protected override void BuildRenderTree( RenderTreeBuilder builder )
{
builder
Expand Down Expand Up @@ -59,11 +38,6 @@ protected override void BuildRenderTree( RenderTreeBuilder builder )
}
}

if ( ParentCollapseHeader?.ParentCollapse != null )
{
builder.AriaExpanded( ParentCollapseHeader.ParentCollapse.Visible.ToString().ToLowerInvariant() );
}

builder.OnClick( this, EventCallback.Factory.Create<MouseEventArgs>( this, ClickHandler ) );
builder.OnClickPreventDefault( Type == ButtonType.Link && To != null && To.StartsWith( "#" ) );

Expand Down Expand Up @@ -98,28 +72,4 @@ protected override RenderFragment ProvideDefaultLoadingTemplate()
}

#endregion

#region Properties

/// <summary>
/// Gets or sets the content visibility.
/// </summary>
[CascadingParameter( Name = "CollapseVisible" )]
public bool CollapseVisible
{
get => collapseVisible;
set
{
collapseVisible = value;

DirtyClasses();
}
}

/// <summary>
/// Gets or sets the cascaded parent collapse header component.
/// </summary>
[CascadingParameter] protected CollapseHeader ParentCollapseHeader { get; set; }

#endregion
}
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
15 changes: 7 additions & 8 deletions Source/Blazorise.Bulma/Providers/BulmaClassProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,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 +761,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 +821,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
Loading
Loading