Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 8 additions & 0 deletions src/BootstrapBlazor.Server/Components/Samples/Cards.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ private AttributeItem[] GetAttributes() =>
DefaultValue = " — "
},
new()
{
Name = nameof(Card.HeaderPaddingY),
Description = Localizer["HeaderPaddingY"],
Type = "string?",
ValueList = " — ",
DefaultValue = " — "
},
new()
{
Name = "Color",
Description = Localizer["Color"],
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3803,7 +3803,8 @@
"CollapsibleTitle": "Collapsible",
"CollapsibleHeaderTemplate": "Header Template",
"CollapsibleBody": "Click card hader for collapse/expand card body",
"ShadowBody": "Shadow effect sample"
"ShadowBody": "Shadow effect sample",
"HeaderPaddingY": "Header top and bottom padding"
},
"BootstrapBlazor.Server.Components.Samples.Calendars": {
"Title": "Calendar",
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3803,7 +3803,8 @@
"CollapsibleTitle": "可以收缩展开的卡片",
"CollapsibleBody": "点击 Header 收缩/展开",
"CollapsibleHeaderTemplate": "这里是模板",
"ShadowBody": "阴影特效示例"
"ShadowBody": "阴影特效示例",
"HeaderPaddingY": "Header 上下内边距"
},
"BootstrapBlazor.Server.Components.Samples.Calendars": {
"Title": "Calendar 日历框",
Expand Down
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/Components/Card/Card.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@inherits BootstrapModuleComponentBase
@attribute [BootstrapModuleAutoLoader(JSObjectReference = true)]

<div @attributes="@AdditionalAttributes" class="@ClassString" id="@Id">
<div @attributes="@AdditionalAttributes" id="@Id" class="@ClassString" style="@HeaderStyleString">
@if (HeaderTemplate != null || !string.IsNullOrEmpty(HeaderText))
{
<div class="card-header">
Expand Down Expand Up @@ -33,7 +33,7 @@
}
</div>
}
<div class="@BodyClassName" id="@BodyId">
<div id="@BodyId" class="@BodyClassName">
@if (IsCollapsible)
{
<div class="card-body-wrapper">
Expand Down
11 changes: 11 additions & 0 deletions src/BootstrapBlazor/Components/Card/Card.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public partial class Card
.AddClass("text-muted", IsCenter)
.Build();

/// <summary>
/// 获得/设置 Card Header 高度 padding Y轴值 默认 null
/// <para>单位需自行给定 如 0.25rem</para>
/// </summary>
[Parameter]
public string? HeaderPaddingY { get; set; }

/// <summary>
/// 获得/设置 收缩展开箭头图标 默认 fa-solid fa-circle-chevron-right
/// </summary>
Expand Down Expand Up @@ -119,6 +126,10 @@ public partial class Card
[NotNull]
private IIconTheme? IconTheme { get; set; }

private string? HeaderStyleString => CssBuilder.Default()
.AddStyle("--bs-card-cap-padding-y", HeaderPaddingY)
.Build();
Comment thread
ArgoZhang marked this conversation as resolved.

/// <summary>
/// <inheritdoc/>
/// </summary>
Expand Down
Loading