You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/Grid/Item.razor

49 lines
1.7 KiB

@namespace Connected.Components
@using Connected.Annotations;
@using Connected.Utilities
@using Connected.Extensions
@inherits UIComponent
<div @attributes="UserAttributes" class="@Classname" style="@Style">
@ChildContent
</div>
@code {
protected string Classname =>
new CssBuilder("grid-item")
.AddClass($"grid-item-xs-{xs.ToString()}", xs != 0)
.AddClass($"grid-item-sm-{sm.ToString()}", sm != 0)
.AddClass($"grid-item-md-{md.ToString()}", md != 0)
.AddClass($"grid-item-lg-{lg.ToString()}", lg != 0)
.AddClass($"grid-item-xl-{xl.ToString()}", xl != 0)
.AddClass($"grid-item-xxl-{xxl.ToString()}", xxl != 0)
.AddClass(Class)
.Build();
[CascadingParameter]
private Grid Parent { get; set; }
[Parameter] [Category(CategoryTypes.Item.Behavior)] public int xs { get; set; }
[Parameter] [Category(CategoryTypes.Item.Behavior)] public int sm { get; set; }
[Parameter] [Category(CategoryTypes.Item.Behavior)] public int md { get; set; }
[Parameter] [Category(CategoryTypes.Item.Behavior)] public int lg { get; set; }
[Parameter] [Category(CategoryTypes.Item.Behavior)] public int xl { get; set; }
[Parameter] [Category(CategoryTypes.Item.Behavior)] public int xxl { get; set; }
// ToDo false,auto,true on all sizes.
[Parameter]
[Category(CategoryTypes.Item.Behavior)]
public RenderFragment ChildContent { get; set; }
protected override void OnInitialized()
{
// NOTE: we can't throw here, the component must be able to live alone for the docs API to infer default parameters
//if (Parent == null)
// throw new ArgumentNullException(nameof(Parent), "Item must exist within a Grid");
base.OnInitialized();
}
}