Skip to content

Commit 53efdd0

Browse files
Added other MudText properties to MudTextM3 (#252)
* Added Align and Color properties to MudTextM3 * Added other properties and fixed class settings --------- Co-authored-by: Marco <[email protected]>
1 parent 155dd9f commit 53efdd0

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

CodeBeam.MudBlazor.Extensions/Components/TypographyM3/MudTextM3.razor.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,30 @@ public partial class MudTextM3 : MudComponentBase
1111
{
1212
protected string ClassName => new CssBuilder("mud-typographym3")
1313
.AddClass($"mud-typographym3-{Typo.ToDescriptionString()}-{Size.ToDescriptionString()}") // .mud-typographym3-#{$style}-#{$size}
14+
.AddClass($"mud-{Color.ToDescriptionString()}-text", Color != Color.Default && Color != Color.Inherit)
15+
.AddClass("mud-typography-gutterbottom", GutterBottom)
16+
.AddClass($"mud-typography-align-{ConvertAlign(Align).ToDescriptionString()}", Align != Align.Inherit)
17+
.AddClass("mud-typography-display-inline", Inline)
1418
.AddClass(Class)
1519
.Build();
1620

1721
protected string StyleString => new StyleBuilder()
1822
.AddStyle(Style)
1923
.Build();
2024

25+
private Align ConvertAlign(Align align)
26+
{
27+
return align switch
28+
{
29+
Align.Start => RightToLeft ? Align.Right : Align.Left,
30+
Align.End => RightToLeft ? Align.Left : Align.Right,
31+
_ => align
32+
};
33+
}
34+
35+
[CascadingParameter(Name = "RightToLeft")]
36+
public bool RightToLeft { get; set; }
37+
2138
/// <summary>
2239
/// Set the text-align on the component.
2340
/// </summary>
@@ -37,5 +54,33 @@ public partial class MudTextM3 : MudComponentBase
3754
[Parameter]
3855
[Category(CategoryTypes.Text.Behavior)]
3956
public RenderFragment? ChildContent { get; set; }
57+
58+
/// <summary>
59+
/// Set the text-align on the component.
60+
/// </summary>
61+
[Parameter]
62+
[Category(CategoryTypes.Text.Appearance)]
63+
public Align Align { get; set; } = Align.Inherit;
64+
65+
/// <summary>
66+
/// The color of the component. It supports the theme colors.
67+
/// </summary>
68+
[Parameter]
69+
[Category(CategoryTypes.Text.Appearance)]
70+
public Color Color { get; set; } = Color.Inherit;
71+
72+
/// <summary>
73+
/// If true, the text will have a bottom margin.
74+
/// </summary>
75+
[Parameter]
76+
[Category(CategoryTypes.Text.Appearance)]
77+
public bool GutterBottom { get; set; } = false;
78+
79+
/// <summary>
80+
/// If true, Sets display inline
81+
/// </summary>
82+
[Parameter]
83+
[Category(CategoryTypes.Text.Appearance)]
84+
public bool Inline { get; set; }
4085
}
4186
}

0 commit comments

Comments
 (0)