using Connected.Annotations;
using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class TextContent : UIComponent
{
protected string Classname =>
new CssBuilder("mud-typography")
.AddClass($"mud-typography-{Typo.ToDescriptionString()}")
.AddClass($"mud-{Color.ToDescriptionString()}-text", Color != ThemeColor.Default && Color != ThemeColor.Inherit)
.AddClass("mud-typography-gutterbottom", GutterBottom)
.AddClass($"mud-typography-align-{ConvertAlign(Align).ToDescriptionString()}", Align != Align.Inherit)
.AddClass("mud-typography-display-inline", Inline)
.AddClass(Class)
.Build();
private Align ConvertAlign(Align align)
{
return align switch
{
Align.Start => RightToLeft ? Align.Right : Align.Left,
Align.End => RightToLeft ? Align.Left : Align.Right,
_ => align
};
}
[CascadingParameter(Name = "RightToLeft")] public bool RightToLeft { get; set; }
///
/// Applies the theme typography styles.
///
[Parameter]
[Category(CategoryTypes.Text.Appearance)]
public Typo Typo { get; set; } = Typo.body1;
///
/// Set the text-align on the component.
///
[Parameter]
[Category(CategoryTypes.Text.Appearance)]
public Align Align { get; set; } = Align.Inherit;
///
/// The color of the component. It supports the theme colors.
///
[Parameter]
[Category(CategoryTypes.Text.Appearance)]
public ThemeColor Color { get; set; } = ThemeColor.Inherit;
///
/// If true, the text will have a bottom margin.
///
[Parameter]
[Category(CategoryTypes.Text.Appearance)]
public bool GutterBottom { get; set; } = false;
///
/// Child content of component.
///
[Parameter]
[Category(CategoryTypes.Text.Behavior)]
public RenderFragment ChildContent { get; set; }
///
/// If true, Sets display inline
///
[Parameter]
[Category(CategoryTypes.Text.Appearance)]
public bool Inline { get; set; }
}