mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-16 01:41:14 +08:00
f9b615c2ca
...for affix,back-top,breadcrumb,card,divider,typogragpy and timeline Co-authored-by: ElderJames <shunjiey@hotmail.com>
68 lines
2.3 KiB
C#
68 lines
2.3 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Rendering;
|
|
using System;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public class Paragraph : TypographyBase
|
|
{
|
|
[Parameter]
|
|
public bool Code { get; set; } = false;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
base.OnInitialized();
|
|
SetClassMap();
|
|
}
|
|
|
|
protected void SetClassMap()
|
|
{
|
|
string prefixName = "ant-typography";
|
|
ClassMapper.Clear()
|
|
.Add("ant-typography")
|
|
.If($"{prefixName}-{Type}", () => !string.IsNullOrEmpty(Type))
|
|
.If($"{prefixName}-disabled", () => Disabled);
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
base.OnParametersSet();
|
|
SetClassMap();
|
|
}
|
|
|
|
protected override void BuildRenderTree(RenderTreeBuilder builder)
|
|
{
|
|
if (builder != null)
|
|
{
|
|
base.BuildRenderTree(builder);
|
|
builder.OpenElement(0, "div");
|
|
builder.AddAttribute(1, "class", this.ClassMapper.Class);
|
|
builder.OpenElement(2, "span");
|
|
if (Mark) builder.OpenElement(3, "mark");
|
|
if (Delete) builder.OpenElement(4, "del");
|
|
if (Underline) builder.OpenElement(5, "u");
|
|
if (Code) builder.OpenElement(6, "code");
|
|
if (Strong) builder.OpenElement(7, "strong");
|
|
builder.AddContent(8, ChildContent);
|
|
if (Strong) builder.CloseElement();
|
|
if (Code) builder.CloseElement();
|
|
if (Underline) builder.CloseElement();
|
|
if (Delete) builder.CloseElement();
|
|
if (Mark) builder.CloseElement();
|
|
builder.CloseElement();
|
|
if (Copyable)
|
|
{
|
|
builder.OpenElement(9, "a");
|
|
builder.AddAttribute(10, "onclick", (Action)(async () => await Copy()));
|
|
builder.OpenComponent<Icon>(10);
|
|
builder.AddAttribute(11, "type", "copy");
|
|
builder.AddAttribute(12, "theme", IconThemeType.Outline);
|
|
builder.CloseComponent();
|
|
builder.CloseElement();
|
|
}
|
|
builder.CloseElement();
|
|
}
|
|
}
|
|
}
|
|
}
|