Skip to content

Commit 94944fb

Browse files
committed
doc: 更新示例
1 parent 2994a85 commit 94944fb

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/BootstrapBlazor.Server/Components/Samples/Authenticators.razor

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
max-width: 500px;
1212
margin: 0 auto;
1313
}
14+
15+
.opt-progress-label {
16+
position: absolute;
17+
top: 50%;
18+
left: 50%;
19+
transform: translate(-50%, -50%);
20+
font-size: 0.75rem;
21+
color: var(--bs-body-color);
22+
}
1423
</style>
1524
</HeadContent>
1625

@@ -21,7 +30,10 @@
2130
<PackageTips Name="BootstrapBlazor.Authenticator"></PackageTips>
2231

2332
<DemoBlock Title="@Localizer["BaseUsageText"]" Introduction="@Localizer["IntroText1"]" Name="Normal">
24-
<QRCode Content="@_content" Width="256" class="mb-3"></QRCode>
33+
<QRCode Content="@_content" Width="190" class="mb-3"></QRCode>
2534
<OtpInput Value="@_code" class="text-center mb-3"></OtpInput>
26-
<BootstrapBlazor.Components.Progress Value="@_remain" IsShowValue="false"></BootstrapBlazor.Components.Progress>
35+
<div class="position-relative">
36+
<BootstrapBlazor.Components.Progress Value="@_progress" IsShowValue="false"></BootstrapBlazor.Components.Progress>
37+
<span class="opt-progress-label">@_remain</span>
38+
</div>
2739
</DemoBlock>

src/BootstrapBlazor.Server/Components/Samples/Authenticators.razor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public partial class Authenticators
2323

2424
private string? _code;
2525

26-
private double _remain = 0;
26+
private double _progress = 0;
2727

28-
private int _time = 0;
28+
private int _remain = 0;
2929

3030
/// <summary>
3131
/// <inheritdoc/>
@@ -49,8 +49,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
4949

5050
await Task.Delay(1000);
5151
_code = TotpService.Compute("OMM2LVLFX6QJHMYI");
52-
_time = TotpService.Instance.GetRemainingSeconds();
53-
_remain = (30d - _time) * 100 / 30d;
52+
_remain = TotpService.Instance.GetRemainingSeconds();
53+
_progress = (30d - _remain) * 100 / 30d;
5454
StateHasChanged();
5555
}
5656
}

0 commit comments

Comments
 (0)