Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
12 changes: 0 additions & 12 deletions src/BootstrapBlazor/Components/Toolbar/Toolbar.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,4 @@ public partial class Toolbar
.AddStyle("flex-wrap", "wrap", IsWrap)
.AddStyleFromAttributes(AdditionalAttributes)
.Build();

private readonly List<ComponentBase> _components = [];

/// <summary>
/// 添加按钮到工具栏方法
/// </summary>
public void Add(ComponentBase component) => _components.Add(component);

/// <summary>
/// 移除按钮到工具栏方法
/// </summary>
public void Remove(ComponentBase component) => _components.Remove(component);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@namespace BootstrapBlazor.Components
@inherits BootstrapComponentBase

<div class="bb-toolbar-group btn-group">
<div @attributes="AdditionalAttributes" class="@ClassString">
@ChildContent
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
[Parameter]
public RenderFragment? ChildContent { get; set; }

private string? ClassString => CssBuilder.Default("bb-toolbar-group btn-group")
.AddClassFromAttributes(AdditionalAttributes)
.Build();

/// <summary>
/// <inheritdoc/>
/// </summary>
Expand All @@ -26,14 +30,14 @@
{
base.OnInitialized();

Toolbar?.Add(this);

Check failure on line 33 in src/BootstrapBlazor/Components/Toolbar/ToolbarButtonGroup.razor.cs

View workflow job for this annotation

GitHub Actions / run test

'Toolbar' does not contain a definition for 'Add' and no accessible extension method 'Add' accepting a first argument of type 'Toolbar' could be found (are you missing a using directive or an assembly reference?)
}

private ValueTask DisposeAsync(bool disposing)
{
if (disposing)
{
Toolbar?.Remove(this);

Check failure on line 40 in src/BootstrapBlazor/Components/Toolbar/ToolbarButtonGroup.razor.cs

View workflow job for this annotation

GitHub Actions / run test

There is no argument given that corresponds to the required parameter 'value' of 'CollectionExtensions.Remove<TKey, TValue>(IDictionary<TKey, TValue>, TKey, out TValue)'
}

return ValueTask.CompletedTask;
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor/Components/Toolbar/ToolbarItem.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@namespace BootstrapBlazor.Components
@inherits BootstrapComponentBase

<div class="bb-toolbar-item">
<div @attributes="AdditionalAttributes" class="@ClassString">
@ChildContent
</div>
7 changes: 5 additions & 2 deletions src/BootstrapBlazor/Components/Toolbar/ToolbarItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ namespace BootstrapBlazor.Components;
/// <summary>
/// ToolbarItem 组件用于在工具栏中添加子组件
/// </summary>
public partial class ToolbarItem : ComponentBase
public partial class ToolbarItem
{
/// <summary>
/// 获得/设置 子组件模板
/// </summary>
[Parameter]
public RenderFragment? ChildContent { get; set; }
}

private string? ClassString => CssBuilder.Default("toolbar-item")
.AddClassFromAttributes(AdditionalAttributes)
.Build();
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace BootstrapBlazor.Components
@inherits BootstrapComponentBase

<div class="bb-toolbar-vr vr"></div>
<div @attributes="AdditionalAttributes" class="@ClassString"></div>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ namespace BootstrapBlazor.Components;
/// </summary>
public partial class ToolbarSeparator
{
private string? ClassString => CssBuilder.Default("bb-toolbar-vr vr")
.AddClassFromAttributes(AdditionalAttributes)
.Build();
}

3 changes: 2 additions & 1 deletion src/BootstrapBlazor/Components/Toolbar/ToolbarSpace.razor
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace BootstrapBlazor.Components
@inherits BootstrapComponentBase

<div class="bb-toolbar-space"></div>
<div @attributes="AdditionalAttributes" class="@ClassString"></div>
3 changes: 3 additions & 0 deletions src/BootstrapBlazor/Components/Toolbar/ToolbarSpace.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ namespace BootstrapBlazor.Components;
/// </summary>
public partial class ToolbarSpace
{
private string? ClassString => CssBuilder.Default("bb-toolbar-space")
.AddClassFromAttributes(AdditionalAttributes)
.Build();
}

Loading