@page "/block"
@inject IStringLocalizer<Blocks> Localizer

<h3>@Localizer["Title"]</h3>

<h4>@Localizer["SubTitle"]</h4>

<DemoBlock Title="@Localizer["BasicUsageTitle"]" Introduction="@Localizer["BasicUsageIntro"]" Name="Normal">
    <div class="mb-3" style="height: 21px;">
        <Block OnQueryCondition="OnQueryCondition" Name="Normal">
            <div>@Localizer["Content"]</div>
        </Block>
    </div>
    <Button Icon="@GetIcon()" Text="@GetText()" OnClick="ToggleCondition" />
</DemoBlock>

<DemoBlock Title="@Localizer["TemplateTitle"]" Introduction="@Localizer["TemplateIntro"]" Name="Template">
    <div class="mb-3" style="height: 21px;">
        <Block OnQueryCondition="OnQueryCondition2" Name="Template">
            <Authorized>
                <div>@((MarkupString)Localizer["TemplateDiv1"].Value)</div>
            </Authorized>
            <NotAuthorized>
                <div>@((MarkupString)Localizer["TemplateDiv2"].Value)</div>
            </NotAuthorized>
        </Block>
    </div>
    <Button Icon="@GetIcon2()" Text="@GetText2()" OnClick="ToggleCondition2" />
</DemoBlock>

<DemoBlock Title="@Localizer["AuthorizateTitle"]" Introduction="@Localizer["AuthorizateIntro"]" Name="Authorizate">
    <div class="mb-3" style="height: 21px;">
        <Block OnQueryCondition="OnQueryUser" Name="Authorized">
            <div>@((MarkupString)Localizer["AuthorizateDiv1", UserName].Value)</div>
        </Block>
    </div>
    <Microsoft.AspNetCore.Components.Authorization.AuthorizeView>
        <Authorized>
            <div>@((MarkupString)Localizer["AuthorizateDiv2", context.User.Identity?.Name!].Value)</div>
        </Authorized>
        <NotAuthorized>
            <div>@((MarkupString)Localizer["AuthorizateDiv3"].Value)</div>
        </NotAuthorized>
    </Microsoft.AspNetCore.Components.Authorization.AuthorizeView>
    <Button Icon="@GetUser()" Text="@GetUserText()" OnClick="ToggleAuthor" class="mt-3" />
</DemoBlock>

<DemoBlock Title="@Localizer["UsersTitle"]" Introduction="@Localizer["UsersIntro"]" Name="Users">
    <div style="height: 21px;">
        <Block Users="@Users">
            <div>@((MarkupString)Localizer["UsersDiv1", UserName].Value)</div>
        </Block>
    </div>
    <Button Icon="@GetUser()" Text="@GetUserText()" OnClick="ToggleAuthor" class="mt-3" />

</DemoBlock>

<DemoBlock Title="@Localizer["RolesTitle"]" Introduction="@Localizer["RolesIntro"]" Name="Roles">
    <div style="height: 21px;">
        <Block Roles="@Roles">
            <div>@((MarkupString)Localizer["RolesDiv1"].Value)</div>
        </Block>
    </div>
    <Button Icon="@GetUser()" Text="@GetUserText()" OnClick="ToggleAuthor" class="mt-3" />
</DemoBlock>

<Tips class="mt-3">
    <p>@((MarkupString)Localizer["Tips"].Value)</p>
</Tips>

<AttributeTable Items="@GetAttributes()" />
