Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
--bs-btn-hover-bg: var(--bb-layout-button-hover-bg);
--bs-btn-active-bg: var(--bb-layout-button-active-bg);
box-shadow: var(--bb-layout-button-shadow);
right: 1rem;
bottom: 9rem;
}

::deep .btn-theme img {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,60 +1,4 @@
::deep .btn-fade {
opacity: 0.7;
box-shadow: var(--bb-layout-button-shadow);
transition: opacity .3s linear;
position: fixed;
z-index: 1001;
}

::deep .btn-fade:hover {
opacity: 1;
}

::deep .btn-update {
--bs-btn-bg: var(--bb-layout-button-update-bg);
--bs-btn-hover-bg: var(--bs-btn-bg);
--bs-btn-active-bg: var(--bs-btn-bg);
bottom: 5rem;
right: 1rem;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}

::deep .btn-update img {
width: 55%;
margin-inline-start: 2px;
}

::deep .btn-chat {
--bs-btn-bg: var(--bb-layout-button-bg);
--bs-btn-hover-bg: var(--bb-layout-button-hover-bg);
--bs-btn-active-bg: var(--bb-layout-button-active-bg);
box-shadow: var(--bb-layout-button-shadow);
right: 1rem;
bottom: 13rem;
display: flex;
align-items: center;
justify-content: center;
color: var(--bb-button-chat-color);
}

::deep .btn-theme-mode {
--bs-btn-bg: var(--bb-layout-button-bg);
--bs-btn-hover-bg: var(--bb-layout-button-hover-bg);
--bs-btn-active-bg: var(--bb-layout-button-active-bg);
box-shadow: var(--bb-layout-button-shadow);
bottom: 17rem;
right: 1rem;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
color: var(--bb-button-chat-color);
}

::deep pre {
::deep pre {
color: #e83e8c;
margin-bottom: 0;
max-height: 260px;
Expand Down
28 changes: 21 additions & 7 deletions src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,25 @@
@Body
</section>

<ThemeMode />

<LinkButton TooltipPlacement="Placement.Left" ButtonStyle="ButtonStyle.Circle" Color="Color.None" TooltipText="@ChatTooltip" class="btn-fade btn-chat" Url="./ai-chat" Icon="fa-solid fa-comments"></LinkButton>

<ThemeChooser></ThemeChooser>

<LinkButton TooltipPlacement="Placement.Left" ButtonStyle="ButtonStyle.Circle" Color="Color.None" TooltipText="@Title" class="btn-fade btn-update" Url="@WebsiteOption.CurrentValue.WikiUrl" Target="_blank" ImageUrl="@WebsiteOption.CurrentValue.GetAssetUrl("images/log.svg")"></LinkButton>
<DialButton DialMode="DialMode.Radial" Icon="fa-solid fa-gear" Radius="100" Placement="Placement.BottomEnd" IsAutoClose="false">
<ButtonTemplate>
<div class="btn-circle btn-fade dial-button-gear">
<img src="./images/logo.png" />
</div>
</ButtonTemplate>
<ChildContent>
<DialButtonItem>
<ThemeMode></ThemeMode>
</DialButtonItem>
<DialButtonItem>
<LinkButton TooltipPlacement="Placement.Left" ButtonStyle="ButtonStyle.Circle" Color="Color.None" TooltipText="@ChatTooltip" class="btn-fade btn-chat" Url="./ai-chat" Icon="fa-solid fa-comments"></LinkButton>
</DialButtonItem>
@* <DialButtonItem>
<ThemeChooser></ThemeChooser>
</DialButtonItem> *@
<DialButtonItem>
<LinkButton TooltipPlacement="Placement.Left" ButtonStyle="ButtonStyle.Circle" Color="Color.None" TooltipText="@Title" class="btn-fade btn-update" Url="@WebsiteOption.CurrentValue.WikiUrl" Target="_blank" ImageUrl="@WebsiteOption.CurrentValue.GetAssetUrl("images/log.svg")"></LinkButton>
</DialButtonItem>
</ChildContent>
</DialButton>
</section>
68 changes: 68 additions & 0 deletions src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,70 @@
background-color: var(--bb-sidebar-body-drag-hover-bg);
}

::deep .dial-button {
display: none;
position: fixed;
right: 1rem;
bottom: 1rem;
}

::deep .btn-fade {
opacity: 0.7;
box-shadow: var(--bb-layout-button-shadow);
transition: opacity .3s linear;
}

::deep .btn-fade:hover {
opacity: 1;
}

::deep .btn-update {
--bs-btn-bg: var(--bb-layout-button-update-bg);
--bs-btn-hover-bg: var(--bs-btn-bg);
--bs-btn-active-bg: var(--bs-btn-bg);
display: flex;
justify-content: center;
align-items: center;
}

::deep .btn-update img {
width: 55%;
margin-inline-start: 2px;
}

::deep .btn-chat {
--bs-btn-bg: var(--bb-layout-button-bg);
--bs-btn-hover-bg: var(--bb-layout-button-hover-bg);
--bs-btn-active-bg: var(--bb-layout-button-active-bg);
box-shadow: var(--bb-layout-button-shadow);
display: flex;
align-items: center;
justify-content: center;
color: var(--bb-button-chat-color);
}

::deep .btn-theme-mode {
--bs-btn-bg: var(--bb-layout-button-bg);
--bs-btn-hover-bg: var(--bb-layout-button-hover-bg);
--bs-btn-active-bg: var(--bb-layout-button-active-bg);
box-shadow: var(--bb-layout-button-shadow);
display: flex;
justify-content: center;
align-items: center;
color: var(--bb-button-chat-color);
}

.dial-button-gear {
background-color: var(--bb-primary-color);
border-radius: 50%;
padding: 4px;
cursor: pointer;
}

.dial-button-gear img {
width: 100%;
}

@media (min-width: 768px) {
.section {
--bb-layout-sidebar-width: 300px;
Expand Down Expand Up @@ -102,4 +166,8 @@
.sidebar-bar {
display: block;
}

::deep .dial-button {
display: block;
}
}
9 changes: 8 additions & 1 deletion src/BootstrapBlazor/Components/Button/DialButton.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
<div @key="@item" class="dial-item" role="menuitem" @onclick="@(e => OnClickItem(item))">
@if (ItemTemplate == null)
{
<i class="@item.Icon"></i>
if(item.ChildContent != null)
{
@item.ChildContent
}
else
{
<i class="@item.Icon"></i>
}
}
else
{
Expand Down
16 changes: 8 additions & 8 deletions src/BootstrapBlazor/Components/Button/DialButtonItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ namespace BootstrapBlazor.Components;
public class DialButtonItem : ComponentBase, IDisposable
{
/// <summary>
/// 显示图标
/// 获得/设置 显示图标
/// </summary>
[Parameter]
[NotNull]
#if NET6_0_OR_GREATER
[EditorRequired]
#endif
public string? Icon { get; set; }

/// <summary>
/// 选项值
/// 获得/设置 选项值
/// </summary>
[Parameter]
[NotNull]
#if NET6_0_OR_GREATER
[EditorRequired]
#endif
public string? Value { get; set; }

/// <summary>
/// 获得/设置 组件内容
/// </summary>
[Parameter]
public RenderFragment? ChildContent { get; set; }

[CascadingParameter]
private List<DialButtonItem>? Items { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $bb-button-circle-height: 45px;

// Button DialogButton
$bb-dial-list-zindex: 5;
$bb-dial-item-padding: 0.25rem 1rem;
$bb-dial-item-padding: 0;
$bb-dial-item-hover-bg: #e9ecef;
$bb-dial-item-margin: 6px;
$bb-dial-item-width: 40px;
Expand Down
18 changes: 18 additions & 0 deletions test/UnitTest/Components/DialButtonTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,24 @@ public void ItemTemplate_Ok()
cut.Contains("test-fa-solid fa-cut-cut");
}

[Fact]
public void Item_ChildContent_Ok()
{
var cut = Context.RenderComponent<DialButton>(pb =>
{
pb.Add(i => i.ChildContent, new RenderFragment(pb =>
{
pb.OpenComponent<DialButtonItem>(0);
pb.AddAttribute(1, "ChildContent", new RenderFragment(pb =>
{
pb.AddContent(0, "test-ChildContent");
}));
pb.CloseComponent();
}));
});
cut.Contains("test-ChildContent");
}

[Fact]
public void DialButtonItem_Ok()
{
Expand Down