ant-design-blazor/components/badge/Badge.razor

60 lines
2.0 KiB
C#
Raw Normal View History

@namespace AntDesign
2020-05-28 15:44:07 +08:00
@inherits AntDomComponentBase
<span class="@ClassMapper.Class" @ref="Ref" id="@Id">
@if (ChildContent != null)
{
@ChildContent
}
@if (HasStatusOrColor && ChildContent == null)
2020-05-28 15:44:07 +08:00
{
<span class="@($"ant-badge-status-dot {(StatusOrPresetColor!=null? $"ant-badge-status-{StatusOrPresetColor}":"")}")" style="@DotColorStyle @Style"></span>
2020-05-28 15:44:07 +08:00
@if (!string.IsNullOrEmpty(Text))
{
<span class="ant-badge-status-text">@Text</span>
}
}
else if (CountTemplate != null)
2020-05-28 15:44:07 +08:00
{
<span role="img" class="ant-scroll-number-custom-component">@CountTemplate</span>
}
else
{
@if (!string.IsNullOrEmpty(Text))
{
<span class="ant-badge-status-text">@Text</span>
}
if (_showSup)
2020-05-28 15:44:07 +08:00
{
<sup class="@CountClassMapper.Class" style="@CountStyle @DotColorStyle @Style" title="@Count">
2020-05-28 15:44:07 +08:00
@if (!Dot)
{
@if (Count <= OverflowCount)
2020-05-28 15:44:07 +08:00
{
@for (int i = 0; i < _maxNumberArray.Length; i++)
{
@if (_countArray.Length > i)
{
<span class="ant-scroll-number-only" style="transform: @($"translateY(-{_countArray[i] * 100}%)")">
@foreach (var p in _countSingleArray)
{
<p class="ant-scroll-number-only-unit @(p == _countArray[i] ? "current" : "")">
@p
</p>
}
</span>
}
}
}
else
{
@($"{OverflowCount}+")
}
}
</sup>
}
}
</span>