Put games table in a card, use loading indicator
This commit is contained in:
		
							parent
							
								
									7b6fd7cb0f
								
							
						
					
					
						commit
						68ec83f681
					
				
					 1 changed files with 37 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -3,7 +3,9 @@
 | 
			
		|||
@inject GameService GameService
 | 
			
		||||
@inject NavigationManager NavigationManager
 | 
			
		||||
 | 
			
		||||
<Table TItem="Game" DataSource="@Games">
 | 
			
		||||
<Card Title="Games">
 | 
			
		||||
    <Body>
 | 
			
		||||
        <Table TItem="Game" DataSource="@Games" Loading="@Loading">
 | 
			
		||||
            <Column TData="string">
 | 
			
		||||
                <Image Src="@GetIcon(context)" Height="32" Width="32" Preview="false"></Image>
 | 
			
		||||
            </Column>
 | 
			
		||||
| 
						 | 
				
			
			@ -19,24 +21,32 @@
 | 
			
		|||
                @context.UpdatedBy?.UserName
 | 
			
		||||
            </PropertyColumn>
 | 
			
		||||
            <ActionColumn Title="">
 | 
			
		||||
        <Space>
 | 
			
		||||
                <Space Style="display: flex; justify-content: end">
 | 
			
		||||
                    <SpaceItem>
 | 
			
		||||
                <Button OnClick="() => Edit(context)">Edit</Button>
 | 
			
		||||
                        <Button Type="@ButtonType.Text" Icon="@IconType.Outline.Edit" OnClick="() => Edit(context)" />
 | 
			
		||||
                    </SpaceItem>
 | 
			
		||||
                </Space>
 | 
			
		||||
            </ActionColumn>
 | 
			
		||||
</Table>
 | 
			
		||||
        </Table>
 | 
			
		||||
    </Body>
 | 
			
		||||
</Card>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    IEnumerable<Game> Games { get; set; } = new List<Game>();
 | 
			
		||||
    private string Search { get; set; }
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnInitializedAsync()
 | 
			
		||||
    bool Loading = true;
 | 
			
		||||
 | 
			
		||||
    protected override void OnAfterRender(bool firstRender)
 | 
			
		||||
    {
 | 
			
		||||
        if (firstRender)
 | 
			
		||||
        {
 | 
			
		||||
            Games = GameService.Get().OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToList();
 | 
			
		||||
 | 
			
		||||
            Loading = false;
 | 
			
		||||
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private string GetIcon(Game game)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue