Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(Toggle): update sass file use variable #2610

Merged
merged 5 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 69 additions & 58 deletions src/BootstrapBlazor.Server/Components/Samples/Dialogs.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

<p>@Localizer["Tip1"]:</p>

<p class="code-label">@((MarkupString)Localizer["Tip2"].Value) </p>
<Pre>@@inject DialogService DialogService</Pre>
<Pre>[Inject]
<p class="code-label mb-3">@((MarkupString)Localizer["Tip2"].Value) </p>
<Pre class="mb-3">@@inject DialogService DialogService</Pre>
<Pre class="mb-3">[Inject]
[NotNull]
private DialogService? DialogService { get; set; }
</Pre>
<p class="code-label">@((MarkupString)Localizer["Tip3"].Value)</p>
<Pre>var op = new DialogOption()
<p class="code-label mb-3">@((MarkupString)Localizer["Tip3"].Value)</p>
<Pre class="mb-3">var op = new DialogOption()
{
Title = @Localizer["DialogTitle"],
ShowFooter = false,
Expand All @@ -24,8 +24,8 @@ op.Component = BootstrapDynamicComponent.CreateComponent&lt;DataDialogComponent&
[nameof(DataDialogComponent.OnCloseAsync)] = new Action(() => op.CloseDialogAsync())
});
await DialogService.Show(op);</Pre>
<p class="code-label">@((MarkupString)Localizer["Tip4"].Value)</p>
<Pre>[CascadingParameter]
<p class="code-label mb-3">@((MarkupString)Localizer["Tip4"].Value)</p>
<Pre class="mb-3">[CascadingParameter]
private Func&lt;Task&gt;? OnCloseAsync { get; set; }

private async Task OnClick()
Expand All @@ -36,13 +36,13 @@ private async Task OnClick()
}
}
</Pre>
<p class="code-label">@((MarkupString)Localizer["Tip5"].Value)</p>
<p class="code-label mb-3">@((MarkupString)Localizer["Tip5"].Value)</p>
<Pre>&lt;DialogCloseButton /&gt;</Pre>

<DemoBlock Title="@Localizer["KeyboardTitle"]" Introduction="@Localizer["KeyboardIntro"]" Name="Keyboard">
<p>@((MarkupString)Localizer["KeyboardTip"].Value)</p>
<section ignore class="mb-3">@((MarkupString)Localizer["KeyboardTip"].Value)</section>
<Button OnClick="@KeyboardOnClick">@Localizer["KeyboardOpenDialogButton"]</Button>
<Button OnClick="@OnClickKeyboard" Text="@($"Keyboard: {IsKeyboard}")" class="ms-3" />
<Button OnClick="@OnClickKeyboard" Text="@($"Keyboard: {IsKeyboard}")" class="ms-3" />
</DemoBlock>

<DemoBlock Title="@Localizer["ResizeTitle"]" Introduction="@Localizer["ResizeIntro"]" Name="Resize">
Expand All @@ -58,12 +58,12 @@ private async Task OnClick()
</DemoBlock>

<DemoBlock Title="@Localizer["ComponentTitle"]" Introduction="@Localizer["ComponentIntro"]" Name="Component">
<div class="mb-2">@((MarkupString)Localizer["ComponentTip"].Value)</div>
<section ignore class="mb-3">@((MarkupString)Localizer["ComponentTip"].Value)</section>
<Button @onclick="@ComponentOnClick">@Localizer["ComponentOpenDialogButton"]</Button>
</DemoBlock>

<DemoBlock Title="@Localizer["BodyContextTitle"]" Introduction="@Localizer["BodyContextIntro"]" Name="BodyContext">
<p>@((MarkupString)Localizer["BodyContextTip"].Value)</p>
<section ignore class="mb-3">@((MarkupString)Localizer["BodyContextTip"].Value)</section>
<Button @onclick="@BodyContextOnClick">@Localizer["BodyContextOpenDialogButton"]</Button>
</DemoBlock>

Expand Down Expand Up @@ -92,67 +92,76 @@ private async Task OnClick()
</DemoBlock>

<DemoBlock Title="@Localizer["CloseDialogByCodeTitle"]" Introduction="@Localizer["CloseDialogByCodeIntro"]" Name="CloseDialogByCode">
<div class="mb-2">@((MarkupString)Localizer["CloseDialogByCodeTip"].Value)</div>
<section ignore class="mb-3">@((MarkupString)Localizer["CloseDialogByCodeTip"].Value)</section>
<Button OnClick="@CloseDialogByCodeShow">Dialog</Button>
<Button OnClick="@CloseButtonShow">CloseButton</Button>
</DemoBlock>

<DemoBlock Title="@Localizer["DisableHeaderCloseButtonTitle"]" Introduction="@Localizer["DisableHeaderCloseButtonIntro"]" Name="DisableHeaderCloseButton">
<div class="mb-2">@((MarkupString)Localizer["DisableHeaderCloseButtonTip"].Value)</div>
<section ignore class="mb-3">@((MarkupString)Localizer["DisableHeaderCloseButtonTip"].Value)</section>
<Button @onclick="@ShowNoHeaderCloseButtonDialog">Dialog</Button>
</DemoBlock>

<DemoBlock Title="@Localizer["MultipleDialogTitle"]" Introduction="@Localizer["MultipleDialogIntro"]" Name="MultipleDialog">
<div class="mb-2">@Localizer["MultipleDialogTip1"]</div>
<ul class="ul-demo mb-2">
<li>@Localizer["MultipleDialogTip2"]</li>
<li>@((MarkupString)Localizer["MultipleDialogTip3"].Value)</li>
<li>@Localizer["MultipleDialogTip4"]</li>
<li>@((MarkupString)Localizer["MultipleDialogTip5"].Value)</li>
</ul>
<div class="mb-2">@((MarkupString)Localizer["MultipleDialogDesc"].Value)</div>
<section ignore>
<div class="mb-3">@Localizer["MultipleDialogTip1"]</div>
<ul class="ul-demo mb-3">
<li>@Localizer["MultipleDialogTip2"]</li>
<li>@((MarkupString)Localizer["MultipleDialogTip3"].Value)</li>
<li>@Localizer["MultipleDialogTip4"]</li>
<li>@((MarkupString)Localizer["MultipleDialogTip5"].Value)</li>
</ul>
<div class="mb-3">@((MarkupString)Localizer["MultipleDialogDesc"].Value)</div>
</section>
<Button OnClick="@ShowDialogLoop">@Localizer["MultipleDialogButton"]</Button>
</DemoBlock>

<DemoBlock Title="@Localizer["ModalDialogTitle"]" Introduction="@Localizer["ModalDialogIntro"]" Name="ModalDialog">
<div class="mb-2">@Localizer["ModalDialogTip1"]</div>
<ul class="ul-demo mb-2">
<li>@Localizer["ModalDialogTip2"]</li>
<li>@((MarkupString)Localizer["ModalDialogTip3"].Value)</li>
<li>@((MarkupString)Localizer["ModalDialogTip4"].Value)</li>
<li>@Localizer["ModalDialogTip5"]</li>
</ul>
<section ignore>
<div class="mb-3">@Localizer["ModalDialogTip1"]</div>
<ul class="ul-demo mb-3">
<li>@Localizer["ModalDialogTip2"]</li>
<li>@((MarkupString)Localizer["ModalDialogTip3"].Value)</li>
<li>@((MarkupString)Localizer["ModalDialogTip4"].Value)</li>
<li>@Localizer["ModalDialogTip5"]</li>
</ul>
</section>
<Button OnClick="@OnResultDialogClick">@Localizer["ModalDialogButton"]</Button>
<ConsoleLogger @ref="ModalDialogLogger" class="mt-3" />
</DemoBlock>

<DemoBlock Title="@Localizer["EditDialogTitle"]" Introduction="@Localizer["EditDialogIntro"]" Name="EditDialog">
<div class="mb-2">@Localizer["EditDialogTip1"]</div>
<ul class="ul-demo mb-2">
<li>@Localizer["EditDialogTip2"]</li>
<li>@((MarkupString)Localizer["EditDialogTip3"].Value)</li>
<li>@((MarkupString)Localizer["EditDialogTip4"].Value)</li>
</ul>
<section ingore>
<div class="mb-3">@Localizer["EditDialogTip1"]</div>
<ul class="ul-demo mb-3">
<li>@Localizer["EditDialogTip2"]</li>
<li>@((MarkupString)Localizer["EditDialogTip3"].Value)</li>
<li>@((MarkupString)Localizer["EditDialogTip4"].Value)</li>
</ul>
</section>
<Button OnClick="@OnEditDialogClick">@Localizer["EditDialogButton"]</Button>
</DemoBlock>

<DemoBlock Title="@Localizer["SearchDialogTitle"]" Introduction="@Localizer["SearchDialogIntro"]" Name="SearchDialog">
<div class="mb-2">@Localizer["SearchDialogTip1"]</div>
<ul class="ul-demo mb-2">
<li>@Localizer["SearchDialogTip2"]</li>
<li>@((MarkupString)Localizer["SearchDialogTip3"].Value)</li>
<li>@((MarkupString)Localizer["SearchDialogTip4"].Value)</li>
</ul>
<section ignore>
<div class="mb-3">@Localizer["SearchDialogTip1"]</div>
<ul class="ul-demo mb-3">
<li>@Localizer["SearchDialogTip2"]</li>
<li>@((MarkupString)Localizer["SearchDialogTip3"].Value)</li>
<li>@((MarkupString)Localizer["SearchDialogTip4"].Value)</li>
</ul>
</section>
<Button OnClick="@OnSearchDialogClick">@Localizer["SearchDialogButton"]</Button>
</DemoBlock>

<DemoBlock Title="@Localizer["SaveDialogTitle"]" Introduction="@Localizer["SaveDialogIntro"]" Name="SaveDialog">
<div class="mb-2">@Localizer["SaveDialogTip1"]</div>
<ul class="ul-demo mb-2">
<li>@Localizer["SaveDialogTip2"]</li>
<li>@((MarkupString)Localizer["SaveDialogTip3"].Value)</li>
</ul>

<section ignore>
<div class="mb-2">@Localizer["SaveDialogTip1"]</div>
<ul class="ul-demo mb-2">
<li>@Localizer["SaveDialogTip2"]</li>
<li>@((MarkupString)Localizer["SaveDialogTip3"].Value)</li>
</ul>
</section>
<Button OnClick="@OnSaveDialogClick">@Localizer["SaveDialogButton"]</Button>
</DemoBlock>

Expand All @@ -174,17 +183,19 @@ private async Task OnClick()
</DemoBlock>

<DemoBlock Title="@Localizer["EmailTitle"]" Introduction="@Localizer["EmailIntro"]" Name="Email">
<div class="mb-2">@Localizer["EmailTip1"]</div>
<ul class="ul-demo mb-2">
<li>@((MarkupString)Localizer["EmailTip2"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip3"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip4"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip5"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip6"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip7"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip8"].Value)</li>
</ul>
<label class="form-label">@Localizer["EmailLabel"]:</label>
<section ignore>
<div class="mb-3">@Localizer["EmailTip1"]</div>
<ul class="ul-demo mb-3">
<li>@((MarkupString)Localizer["EmailTip2"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip3"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip4"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip5"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip6"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip7"].Value)</li>
<li>@((MarkupString)Localizer["EmailTip8"].Value)</li>
</ul>
<label class="form-label">@Localizer["EmailLabel"]:</label>
</section>
<div class="input-group">
<BootstrapInput PlaceHolder="@Localizer["EmailInput"]" Value="@EmailInputValue" />
<Button Icon="fa-regular fa-address-card" OnClick="@OnEmailButtonClick" />
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Dialog/Dialog.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class Dialog : IDisposable
/// <summary>
/// 获得/设置 弹出对话框实例集合
/// </summary>
private Dictionary<Dictionary<string, object>, (bool IsKeyboard, bool IsBackdrop)> DialogParameters { get; } = new();
private Dictionary<Dictionary<string, object>, (bool IsKeyboard, bool IsBackdrop)> DialogParameters { get; } = [];

private bool IsKeyboard { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions src/BootstrapBlazor/Components/Drawer/Drawer.razor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--bb-drawer-bg: var(--bs-body-bg);
--bb-drawer-zindex: #{$bb-drawer-zindex};
--bb-drawer-body-shadow: #{$bb-drawer-body-shadow};
--bb-drawer-body-padding: #{$bb-drawer-body-padding};
--bb-drawer-bar-bg: #{$bb-drawer-bar-bg};
--bb-drawer-bar-hover-color: #{$bb-drawer-bar-hover-color};
--bb-drawer-bar-drag-color: #{$bb-drawer-bar-drag-color};
Expand Down Expand Up @@ -38,6 +39,7 @@
z-index: 2;
pointer-events: auto;
display: flex;
padding: var(--bb-drawer-padding);

.drawer-content {
overflow: auto;
Expand Down
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/Components/Modal/Modal.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal void RemoveDialog(ModalDialog dialog)
// 移除当前弹窗
Dialogs.Remove(dialog);

if (Dialogs.Any())
if (Dialogs.Count > 0)
{
ResetShownDialog(Dialogs.Last());
}
Expand Down Expand Up @@ -153,7 +153,7 @@ public async Task CloseCallback()
}

// 多级弹窗支持
if (Dialogs.Any())
if (Dialogs.Count > 0)
{
ResetShownDialog(Dialogs.Last());
}
Expand Down
14 changes: 7 additions & 7 deletions src/BootstrapBlazor/Components/Toggle/Toggle.razor.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.btn-toggle {
--bb-toggle-min-width: 70px;
.btn-toggle {
--bb-toggle-min-width: #{$bb-toggle-min-width};
--bb-toggle-bg-color: #{$bb-toggle-bg-color};
--bb-toggle-color: #{$bb-toggle-color};
--bb-toggle-off-color: #{$bb-toggle-off-color};
--bs-btn-hover-color: #fff;
--bs-btn-border-color: #c0c4cc;
--bs-btn-disabled-border-color: var(--bs-btn-border-color);
--bs-btn-hover-border-color: var(--bs-btn-border-color);
--bs-btn-active-border-color: var(--bs-btn-border-color);
--bs-btn-hover-color: #fff;
--bb-toggle-bg-color: #e0e0e0;
--bb-toggle-color: #fff;
--bb-toggle-off-color: #000;
position: relative;
overflow: hidden;
border: 1px solid #c0c4cc;
border: 1px solid var(--bs-btn-border-color);
border-radius: var(--bs-border-radius);
min-width: var(--bb-toggle-min-width);
min-height: var(--bb-height);
Expand Down
7 changes: 7 additions & 0 deletions src/BootstrapBlazor/wwwroot/scss/theme/bootstrap.blazor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ $bb-divider-text-padding: 0 20px;
// Drawer
$bb-drawer-zindex: 1050;
$bb-drawer-body-shadow: 0 8px 10px -5px rgba(0,0,0,.2), 0 16px 24px 2px rgba(0,0,0,.14), 0 6px 30px 5px rgba(0,0,0,.12);
$bb-drawer-body-padding: 1rem;
$bb-drawer-bar-bg: #d0d7de;
$bb-drawer-bar-hover-color: #409eff;
$bb-drawer-bar-drag-color: #0969da;
Expand Down Expand Up @@ -589,4 +590,10 @@ $bb-timer-button-height: 66px;
$bb-timer-button-padding: 0;
$bb-timer-button-font-size: .75rem;

// Toggle
$bb-toggle-min-width: 70px;
$bb-toggle-bg-color: #e0e0e0;
$bb-toggle-color: #fff;
$bb-toggle-off-color: #000;

@import "../components.scss";
Loading