-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b655ff3
commit f67f0ab
Showing
9 changed files
with
85 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
src/BlazingApple.Components.Shared/BlazingApple.Components.Shared.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/BlazingApple.Components/BlazingApple.Components/Accordion/AccordionSection.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@if(Parent is not null && Data.HasValue) | ||
{ | ||
<div class="accordion-item"> | ||
<h2 class="accordion-header" id="heading-@id"> | ||
<button class="accordion-button" type="button" @onclick="() => _isVisible = !_isVisible" aria-expanded="@_isVisible" aria-controls="collapse-@id"> | ||
@Data.Value.Heading | ||
</button> | ||
</h2> | ||
|
||
<div id="collapse-@id" class="accordion-collapse collapse @(_isVisible ? "show": "")" aria-labelledby="heading-@id" data-bs-parent="#@Parent.Id"> | ||
<div class="accordion-body"> | ||
@Data.Value.Content | ||
</div> | ||
</div> | ||
</div> | ||
} |
17 changes: 17 additions & 0 deletions
17
src/BlazingApple.Components/BlazingApple.Components/Accordion/AccordionSection.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace BlazingApple.Components.Accordion; | ||
|
||
/// <summary>Accordion section</summary> | ||
public partial class AccordionSection : ComponentBase | ||
{ | ||
private bool _isVisible; | ||
private readonly Guid id = Guid.NewGuid(); | ||
|
||
/// <summary>Accordion parent.</summary> | ||
[CascadingParameter] | ||
[Parameter] | ||
public VerticalAccordion? Parent { get; set; } | ||
|
||
/// <summary>Data to pass to the accordion section.</summary> | ||
[Parameter] | ||
public (string Heading, string Content)? Data { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/BlazingApple.Components/BlazingApple.Components/VerticalAccordion.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@using BlazingApple.Components.Accordion | ||
@if (Items is not null) | ||
{ | ||
<CascadingValue Value="this"> | ||
<div class="accordion" id="@Id"> | ||
@foreach((string Heading, string Content) item in Items) | ||
{ | ||
<AccordionSection Data="item" /> | ||
} | ||
</div> | ||
</CascadingValue> | ||
} |
12 changes: 12 additions & 0 deletions
12
src/BlazingApple.Components/BlazingApple.Components/VerticalAccordion.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace BlazingApple.Components; | ||
|
||
/// <summary>Bootstrap styled accordion, vertical layout.</summary> | ||
public partial class VerticalAccordion : ComponentBase | ||
{ | ||
/// <summary>Id in the dom.</summary> | ||
public Guid Id { get; set; } = Guid.NewGuid(); | ||
|
||
/// <summary>The data to render</summary> | ||
[Parameter] | ||
public IEnumerable<(string Heading, string Content)>? Items { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters