UI/Player/Containers/InventoryContainerPanel.razor
@using Sandbox;
@using Sandbox.UI;

@namespace Opium.UI
@inherits Panel

<root class="@( SlotBased ? "grid" : "" )">
    @foreach ( var item in Container.Items )
    {
        <InventoryContainerSlot @Item=@item @Container=@Container /> 
    }
</root>

@code
{
    /// <summary>
    /// The inventory container in question.
    /// </summary>
    public InventoryContainer Container { get; set; }

    /// <summary>
    /// We're a slot based inventory if we have a slot limit.
    /// </summary>
    bool SlotBased => Container.MaxItems > 0;

    protected override int BuildHash()
    {
        return Container.GetHashCode();
    }
}