@page "/guide"
@page "/guide/{Step:int}"
@* This page picks its own layout instead of the default. *@
@layout GuideLayout

<PageTitle>Guide</PageTitle>

<h1>@(Step is null ? "Guide overview" : $"Step {Step}")</h1>

<p class="lead">@Text</p>

<p class="muted">Nesting: MainLayout, then GuideLayout, then Guide.razor.</p>

@if (Step is null or < 3)
{
    <a class="next" href="guide/@((Step ?? 0) + 1)">Next step</a>
}

@code {
    // Null on /guide, a number on /guide/2.
    [Parameter]
    public int? Step { get; set; }

    private string Text => Step switch
    {
        null => "This page has @layout GuideLayout. GuideLayout has @layout MainLayout. So the header comes from MainLayout, the Guide bar and steps come from GuideLayout, and this text comes from the page.",
        1 => "A layout inherits LayoutComponentBase and writes @Body where the page goes. Tap Hide steps, then move between steps: GuideLayout keeps its state, because the same layout instance stays on screen.",
        2 => "RouteView's DefaultLayout applies to pages without @layout. Home uses it. This page overrides it with @layout GuideLayout.",
        _ => "Each .razor.css file is scoped to its own component. MainLayout.razor.css draws the line under this heading with main ::deep h1, because the page renders inside MainLayout's main element."
    };
}
