Skip to content

Commit

Permalink
On this page navigation - account for multi-level jumps in page's sec…
Browse files Browse the repository at this point in the history
…tion hierarchy
  • Loading branch information
Harvey1214 committed Oct 14, 2022
1 parent e3b65ee commit 0b661d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<SectionTitle Id="on-valid-click-with-spinner" Level="1">OnValidClick with spinner</SectionTitle>
<Demo Type="typeof(HxButton_Demo_OnValidClickWithSpinner)" />

<SectionTitle Id="manual-spinner" Level="1">Manual Spinner</SectionTitle>
<SectionTitle Id="manual-spinner" Level="2">Manual Spinner</SectionTitle>
<Demo Type="typeof(HxButton_Demo_ManualSpinner)" />

<SectionTitle Id="spinner-and-single-click-protection" Level="1">Spinner &amp; Single click protection</SectionTitle>
<SectionTitle Id="spinner-and-single-click-protection" Level="3">Spinner &amp; Single click protection</SectionTitle>
<DocAlert Type="DocAlertType.Warning">
EditForm's <code>OnSubmit</code> events are not captured for spinner automation. Use HxButton's <code>OnClick</code>, <code>OnValidClick</code> and <code>OnInvalidClick</code> instead.
</DocAlert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ private RenderFragment GenerateSectionTree() => builder =>
SectionTitle currentSection = Sections.ElementAt(i);

// Handle level adjustments - nested lists.
int levelDifference = Math.Abs(currentSection.Level - currentLevel);
if (currentSection.Level > currentLevel)
{
builder.OpenElement(sequence++, "ul");
for (int j = 0; j < levelDifference; j++)
{
builder.OpenElement(sequence++, "ul");
}
}
else if (currentSection.Level < currentLevel)
{
builder.CloseElement();
for (int j = 0; j < levelDifference; j++)
{
builder.CloseElement();
}
}
currentLevel = currentSection.Level;

Expand Down

0 comments on commit 0b661d6

Please sign in to comment.