@page "/rate"
@inject IStringLocalizer<Rates> Localizer

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

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

<DemoBlock Title="@Localizer["RatesNormalTitle"]"
           Introduction="@Localizer["RatesNormalIntro"]"
           Name="Normal">
    <Rate Value="@BindValue" ValueChanged="@OnValueChanged" />
    <ConsoleLogger @ref="Logger" />
</DemoBlock>

<DemoBlock Title="@Localizer["RatesIconTitle"]"
           Introduction="@Localizer["RatesIconIntro"]"
           Name="Icon">
    <Pre class="mb-3">.custom-rate {
    --bb-rate-font-size: 1.7rem;
    --bb-rate-height: 30px;
    --bb-rate-width: 30px;
    --bb-rate-active-color: var(--bs-primary);
}</Pre>
    <div class="row mt-3">
        <div class="col-12 col-sm-6">
            <Rate @bind-Value="IconListValue" class="custom-rate">
                <ItemTemplate>
                    <i class="@GetIconList(int.Parse(Math.Round(context, 0, MidpointRounding.AwayFromZero).ToString()))"></i>
                </ItemTemplate>
            </Rate>
        </div>
        <div class="col-12 col-sm-6">
            <div class="d-flex align-items-center h-100">
                @GetIconValueChanged()
            </div>
        </div>
    </div>
</DemoBlock>

<DemoBlock Title="@Localizer["RatesDisableTitle"]"
           Introduction="@Localizer["RatesDisableIntro"]"
           Name="Disable">
    <div class="row g-3">
        <div class="col-6">
            <Rate Value="@BindValue1" IsDisable="IsDisable" />
        </div>
        <div class="col-6">
            <Switch @bind-Value="IsDisable" OnText="@Localizer["RatesSwitchOn"]" OnColor="Color.Danger" OffText="@Localizer["RatesSwitchOff"]" OffColor="@Color.Success" />
        </div>
    </div>
</DemoBlock>

<DemoBlock Title="@Localizer["RatesReadOnlyTitle"]"
           Introduction="@Localizer["RatesReadOnlyIntro"]"
           Name="Disable">
    <Rate Value="@BindValue2" IsReadonly="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["RatesShowValueTitle"]"
           Introduction="@Localizer["RatesShowValueIntro"]"
           Name="ShowValue">
    <Rate Value="@BindValue1" ShowValue="true"></Rate>
</DemoBlock>

<DemoBlock Title="@Localizer["RatesIsWrapTitle"]"
           Introduction="@Localizer["RatesIsWrapIntro"]"
           Name="IsWrap">
    <Rate Value="@BindValue3" ShowValue="true" IsWrap="true"></Rate>
</DemoBlock>

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

<EventTable Items="@GetEvents()" />
